C
- the consumer properties typeP
- the producer properties typepublic abstract class AbstractMessageChannelBinder<C extends ConsumerProperties,P extends ProducerProperties,PP extends ProvisioningProvider<C,P>> extends AbstractBinder<org.springframework.messaging.MessageChannel,C,P>
AbstractBinder
that serves as base class for MessageChannel
binders.
Implementors must implement the following methods:
AbstractBinder.JavaClassMimeTypeConversion
Modifier and Type | Field and Description |
---|---|
protected static org.springframework.expression.ExpressionParser |
EXPRESSION_PARSER |
protected PP |
provisioningProvider
ProvisioningProvider delegated by the downstream binder implementations. |
logger
Constructor and Description |
---|
AbstractMessageChannelBinder(boolean supportsHeadersNatively,
String[] headersToEmbed,
PP provisioningProvider) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterUnbindConsumer(ConsumerDestination destination,
String group,
C consumerProperties)
Invoked after the unbinding of a consumer.
|
protected void |
afterUnbindProducer(ProducerDestination destination,
P producerProperties)
Invoked after the unbinding of a producer.
|
protected abstract org.springframework.integration.core.MessageProducer |
createConsumerEndpoint(ConsumerDestination destination,
String group,
C properties)
Creates
MessageProducer that receives data from the consumer destination. |
protected abstract org.springframework.messaging.MessageHandler |
createProducerMessageHandler(ProducerDestination destination,
P producerProperties)
Creates a
MessageHandler with the ability to send data to the target
middleware. |
Binding<org.springframework.messaging.MessageChannel> |
doBindConsumer(String name,
String group,
org.springframework.messaging.MessageChannel inputChannel,
C properties)
Binds an inbound channel to a given destination.
|
Binding<org.springframework.messaging.MessageChannel> |
doBindProducer(String destination,
org.springframework.messaging.MessageChannel outputChannel,
P producerProperties)
Binds an outbound channel to a given destination.
|
afterPropertiesSet, applyPrefix, bindConsumer, bindProducer, buildPartitionRoutingExpression, buildRetryTemplate, constructDLQName, deserializePayloadIfNecessary, deserializePayloadIfNecessary, getApplicationContext, getBeanFactory, groupedName, onInit, serializePayloadIfNecessary, serializePayloadIfNecessary, setApplicationContext, setCodec, setIntegrationEvaluationContext
protected static final org.springframework.expression.ExpressionParser EXPRESSION_PARSER
protected final PP extends ProvisioningProvider<C,P> provisioningProvider
ProvisioningProvider
delegated by the downstream binder implementations.public final Binding<org.springframework.messaging.MessageChannel> doBindProducer(String destination, org.springframework.messaging.MessageChannel outputChannel, P producerProperties) throws BinderException
ProvisioningProvider.provisionProducerDestination(String, ProducerProperties)
and createProducerMessageHandler(ProducerDestination, ProducerProperties)
for handling the middleware specific logic. If the returned producer message
handler is an InitializingBean
then
InitializingBean.afterPropertiesSet()
will be called on it. Similarly, if
the returned producer message handler e ndpoint is a Lifecycle
, then
Lifecycle.start()
will be called on it.doBindProducer
in class AbstractBinder<org.springframework.messaging.MessageChannel,C extends ConsumerProperties,P extends ProducerProperties>
destination
- the name of the destinationoutputChannel
- the channel to be boundproducerProperties
- the ProducerProperties
of the bindingBinderException
- on internal errors during bindingprotected abstract org.springframework.messaging.MessageHandler createProducerMessageHandler(ProducerDestination destination, P producerProperties) throws Exception
MessageHandler
with the ability to send data to the target
middleware. If the returned instance is also a Lifecycle
, it will be
stopped automatically by the binder.
In order to be fully compliant, the MessageHandler
of the binder must
observe the following headers:
BinderHeaders.PARTITION_HEADER
- indicates the target partition where
the message must be sentdestination
- the name of the target destinationproducerProperties
- the producer propertiesException
protected void afterUnbindProducer(ProducerDestination destination, P producerProperties)
destination
- the bound destinationproducerProperties
- the producer propertiespublic final Binding<org.springframework.messaging.MessageChannel> doBindConsumer(String name, String group, org.springframework.messaging.MessageChannel inputChannel, C properties) throws BinderException
ProvisioningProvider.provisionConsumerDestination(String, String, ConsumerProperties)
and
createConsumerEndpoint(ConsumerDestination, String, ConsumerProperties)
for handling middleware-specific logic. If the returned consumer endpoint is an
InitializingBean
then InitializingBean.afterPropertiesSet()
will be
called on it. Similarly, if the returned consumer endpoint is a Lifecycle
,
then Lifecycle.start()
will be called on it.doBindConsumer
in class AbstractBinder<org.springframework.messaging.MessageChannel,C extends ConsumerProperties,P extends ProducerProperties>
name
- the name of the destinationgroup
- the consumer groupinputChannel
- the channel to be boundproperties
- the ConsumerProperties
of the bindingBinderException
- on internal errors during bindingprotected abstract org.springframework.integration.core.MessageProducer createConsumerEndpoint(ConsumerDestination destination, String group, C properties) throws Exception
MessageProducer
that receives data from the consumer destination.
will be started and stopped by the binder.group
- the consumer groupdestination
- reference to the consumer destinationproperties
- the consumer propertiesException
protected void afterUnbindConsumer(ConsumerDestination destination, String group, C consumerProperties)
destination
- the consumer destinationgroup
- the consumer groupconsumerProperties
- the consumer propertiesCopyright © 2017 Pivotal Software, Inc.. All rights reserved.