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:
#createProducerMessageHandler(ProducerDestination, ProducerProperties)createConsumerEndpoint(ConsumerDestination, String, ConsumerProperties)
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractMessageChannelBinder.ErrorInfrastructure |
| Modifier and Type | Field and Description |
|---|---|
protected static org.springframework.expression.ExpressionParser |
EXPRESSION_PARSER |
protected PP |
provisioningProvider
ProvisioningProvider delegated by the downstream binder implementations. |
contentTypeResolver, 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,
org.springframework.messaging.MessageChannel errorChannel)
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.
|
protected String |
errorsBaseName(ConsumerDestination destination,
String group,
C consumerProperties) |
protected String |
errorsBaseName(ProducerDestination destination) |
protected org.springframework.messaging.MessageHandler |
getDefaultErrorMessageHandler(org.springframework.cloud.stream.binder.LastSubscriberAwareChannel errorChannel,
boolean defaultErrorChannelPresent)
Return the default error message handler, which throws the error message payload to
the caller if there are no user handlers subscribed.
|
protected String |
getErrorBridgeName(ConsumerDestination destination,
String group,
C consumerProperties) |
protected String |
getErrorBridgeName(ProducerDestination destination) |
protected org.springframework.messaging.MessageHandler |
getErrorMessageHandler(ConsumerDestination destination,
String group,
C consumerProperties)
Binders can return a message handler to be subscribed to the error channel.
|
protected String |
getErrorMessageHandlerName(ConsumerDestination destination,
String group,
C consumerProperties) |
protected org.springframework.integration.support.ErrorMessageStrategy |
getErrorMessageStrategy()
Binders can return an
ErrorMessageStrategy for building error messages; binder
implementations typically might add extra headers to the error message. |
protected String |
getErrorRecovererName(ConsumerDestination destination,
String group,
C consumerProperties) |
protected AbstractMessageChannelBinder.ErrorInfrastructure |
registerErrorInfrastructure(ConsumerDestination destination,
String group,
C consumerProperties)
Build an errorChannelRecoverer that writes to a pub/sub channel for the destination
when an exception is thrown to a consumer.
|
afterPropertiesSet, applyPrefix, bindConsumer, bindProducer, buildPartitionRoutingExpression, buildRetryTemplate, constructDLQName, deserializePayloadIfNecessary, deserializePayloadIfNecessary, getApplicationContext, getBeanFactory, groupedName, onInit, serializePayloadIfNecessary, serializePayloadIfNecessary, setApplicationContext, setCodec, setIntegrationEvaluationContextprotected 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, org.springframework.messaging.MessageChannel errorChannel) 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 propertieserrorChannel - the error channel (if enabled, otherwise null). If not null,
the binder must wire this channel into the producer endpoint so that errors
are forwarded to it.Exceptionprotected 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 propertiesExceptionprotected void afterUnbindConsumer(ConsumerDestination destination, String group, C consumerProperties)
destination - the consumer destinationgroup - the consumer groupconsumerProperties - the consumer propertiesprotected final AbstractMessageChannelBinder.ErrorInfrastructure registerErrorInfrastructure(ConsumerDestination destination, String group, C consumerProperties)
destination - the destination.group - the group.consumerProperties - the properties.protected org.springframework.messaging.MessageHandler getErrorMessageHandler(ConsumerDestination destination, String group, C consumerProperties)
destination - the destination.group - the group.consumerProperties - the properties.protected org.springframework.messaging.MessageHandler getDefaultErrorMessageHandler(org.springframework.cloud.stream.binder.LastSubscriberAwareChannel errorChannel,
boolean defaultErrorChannelPresent)
errorChannel - the error channel.defaultErrorChannelPresent - true if the context has a default 'errorChannel'.protected org.springframework.integration.support.ErrorMessageStrategy getErrorMessageStrategy()
ErrorMessageStrategy for building error messages; binder
implementations typically might add extra headers to the error message.protected String getErrorRecovererName(ConsumerDestination destination, String group, C consumerProperties)
protected String getErrorMessageHandlerName(ConsumerDestination destination, String group, C consumerProperties)
protected String getErrorBridgeName(ConsumerDestination destination, String group, C consumerProperties)
protected String errorsBaseName(ConsumerDestination destination, String group, C consumerProperties)
protected String getErrorBridgeName(ProducerDestination destination)
protected String errorsBaseName(ProducerDestination destination)
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.