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> implements PollableConsumerBinder<org.springframework.messaging.MessageHandler,C>, org.springframework.context.ApplicationEventPublisherAware
AbstractBinder that serves as base class for MessageChannel binders.
 Implementors must implement the following methods:
 | Modifier and Type | Class and Description | 
|---|---|
| protected static class  | AbstractMessageChannelBinder.ErrorInfrastructure | 
| protected static class  | AbstractMessageChannelBinder.PolledConsumerResources | 
| Modifier and Type | Field and Description | 
|---|---|
| protected PP | provisioningProviderProvisioningProviderdelegated by the downstream binder implementations. | 
logger| Constructor and Description | 
|---|
| AbstractMessageChannelBinder(String[] headersToEmbed,
                            PP provisioningProvider) | 
| AbstractMessageChannelBinder(String[] headersToEmbed,
                            PP provisioningProvider,
                            ListenerContainerCustomizer<?> containerCustomizer) | 
| 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. | 
| Binding<PollableSource<org.springframework.messaging.MessageHandler>> | bindPollableConsumer(String name,
                    String group,
                    PollableSource<org.springframework.messaging.MessageHandler> inboundBindTarget,
                    C properties)Configure a binding for a pollable message source. | 
| protected abstract org.springframework.integration.core.MessageProducer | createConsumerEndpoint(ConsumerDestination destination,
                      String group,
                      C properties)Creates  MessageProducerthat receives data from the consumer destination. | 
| protected AbstractMessageChannelBinder.PolledConsumerResources | createPolledConsumerResources(String name,
                             String group,
                             ConsumerDestination destination,
                             C consumerProperties) | 
| protected abstract org.springframework.messaging.MessageHandler | createProducerMessageHandler(ProducerDestination destination,
                            P producerProperties,
                            org.springframework.messaging.MessageChannel errorChannel)Create a  MessageHandlerwith the ability to send data to the target
 middleware. | 
| protected org.springframework.messaging.MessageHandler | createProducerMessageHandler(ProducerDestination destination,
                            P producerProperties,
                            org.springframework.messaging.MessageChannel channel,
                            org.springframework.messaging.MessageChannel errorChannel)Create a  MessageHandlerwith 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.context.ApplicationEventPublisher | getApplicationEventPublisher() | 
| protected <L> ListenerContainerCustomizer<L> | getContainerCustomizer() | 
| 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  ErrorMessageStrategyfor building error messages; binder
 implementations typically might add extra headers to the error message. | 
| protected String | getErrorRecovererName(ConsumerDestination destination,
                     String group,
                     C consumerProperties) | 
| protected org.springframework.messaging.MessageHandler | getPolledConsumerErrorMessageHandler(ConsumerDestination destination,
                                    String group,
                                    C consumerProperties)Binders can return a message handler to be subscribed to the error channel. | 
| protected org.springframework.retry.RecoveryCallback<Object> | getPolledConsumerRecoveryCallback(AbstractMessageChannelBinder.ErrorInfrastructure errorInfrastructure,
                                 C properties)Implementations can override the default  ErrorMessageSendingRecoverer. | 
| protected void | postProcessOutputChannel(org.springframework.messaging.MessageChannel outputChannel,
                        P producerProperties)Allows subclasses to perform post processing on the channel - for example to
 add more interceptors. | 
| protected void | postProcessPollableSource(DefaultPollableMessageSource bindingTarget) | 
| 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. | 
| protected AbstractMessageChannelBinder.ErrorInfrastructure | registerErrorInfrastructure(ConsumerDestination destination,
                           String group,
                           C consumerProperties,
                           boolean polled)Build an errorChannelRecoverer that writes to a pub/sub channel for the destination
 when an exception is thrown to a consumer. | 
| void | setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) | 
| protected boolean | useNativeEncoding(P producerProperties)Whether the producer for the destination being created should be configured to use
 native encoding which may, or may not, be determined from the properties. | 
afterPropertiesSet, applyPrefix, bindConsumer, bindProducer, buildPartitionRoutingExpression, buildRetryTemplate, constructDLQName, getApplicationContext, getBeanFactory, getEvaluationContext, groupedName, onInit, serializePayloadIfNecessary, setApplicationContextprotected final PP extends ProvisioningProvider<C,P> provisioningProvider
ProvisioningProvider delegated by the downstream binder implementations.public AbstractMessageChannelBinder(String[] headersToEmbed, PP provisioningProvider)
public AbstractMessageChannelBinder(String[] headersToEmbed, PP provisioningProvider, ListenerContainerCustomizer<?> containerCustomizer)
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwareprotected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
protected <L> ListenerContainerCustomizer<L> getContainerCustomizer()
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, MessageChannel)
 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 endpoint 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 boolean useNativeEncoding(P producerProperties)
P#isUseNativeEncoding().producerProperties - the properties.protected void postProcessOutputChannel(org.springframework.messaging.MessageChannel outputChannel,
                                        P producerProperties)
outputChannel - the channel.producerProperties - the producer properties.protected org.springframework.messaging.MessageHandler createProducerMessageHandler(ProducerDestination destination, P producerProperties, org.springframework.messaging.MessageChannel channel, 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 destination.producerProperties - the producer properties.channel - the channel to bind.errorChannel - 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 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 bindingpublic Binding<PollableSource<org.springframework.messaging.MessageHandler>> bindPollableConsumer(String name, String group, PollableSource<org.springframework.messaging.MessageHandler> inboundBindTarget, C properties)
PollableConsumerBinderbindPollableConsumer in interface PollableConsumerBinder<org.springframework.messaging.MessageHandler,C extends ConsumerProperties>name - the binding name.group - the consumer group.inboundBindTarget - the binding target.properties - the consumer properties.protected void postProcessPollableSource(DefaultPollableMessageSource bindingTarget)
protected org.springframework.retry.RecoveryCallback<Object> getPolledConsumerRecoveryCallback(AbstractMessageChannelBinder.ErrorInfrastructure errorInfrastructure, C properties)
ErrorMessageSendingRecoverer.errorInfrastructure - the infrastructure.properties - the consumer properties.protected AbstractMessageChannelBinder.PolledConsumerResources createPolledConsumerResources(String name, String group, ConsumerDestination destination, C consumerProperties)
protected 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 final AbstractMessageChannelBinder.ErrorInfrastructure registerErrorInfrastructure(ConsumerDestination destination, String group, C consumerProperties, boolean polled)
destination - the destination.group - the group.consumerProperties - the properties.polled - true if this is for a polled consumer.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 getPolledConsumerErrorMessageHandler(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 © 2018 Pivotal Software, Inc.. All rights reserved.