public class RabbitMessageChannelBinder extends AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner> implements ExtendedPropertiesBinder<org.springframework.messaging.MessageChannel,org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties,org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>, org.springframework.beans.factory.DisposableBean
Binder
implementation backed by
RabbitMQ.AbstractMessageChannelBinder.ErrorInfrastructure
EXPRESSION_PARSER, provisioningProvider
contentTypeResolver, logger
Constructor and Description |
---|
RabbitMessageChannelBinder(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory,
org.springframework.boot.autoconfigure.amqp.RabbitProperties rabbitProperties,
org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner provisioningProvider) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterUnbindConsumer(ConsumerDestination consumerDestination,
String group,
ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> consumerProperties)
Invoked after the unbinding of a consumer.
|
protected org.springframework.integration.core.MessageProducer |
createConsumerEndpoint(ConsumerDestination consumerDestination,
String group,
ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> properties)
Creates
MessageProducer that receives data from the consumer destination. |
protected org.springframework.messaging.MessageHandler |
createProducerMessageHandler(ProducerDestination producerDestination,
ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties> producerProperties,
org.springframework.messaging.MessageChannel errorChannel)
Creates a
MessageHandler with the ability to send data to the target
middleware. |
void |
destroy() |
protected String |
errorsBaseName(ConsumerDestination destination,
String group,
ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> consumerProperties) |
protected org.springframework.messaging.MessageHandler |
getErrorMessageHandler(ConsumerDestination destination,
String group,
ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> properties)
Binders can return a message handler to be subscribed to the error channel.
|
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. |
org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties |
getExtendedConsumerProperties(String channelName) |
org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties |
getExtendedProducerProperties(String channelName) |
void |
onInit()
Subclasses may implement this method to perform any necessary initialization.
|
void |
setAdminAddresses(String[] adminAddresses) |
void |
setCompressingPostProcessor(org.springframework.amqp.core.MessagePostProcessor compressingPostProcessor)
Set a
MessagePostProcessor to compress messages. |
void |
setDecompressingPostProcessor(org.springframework.amqp.core.MessagePostProcessor decompressingPostProcessor)
Set a
MessagePostProcessor to decompress messages. |
void |
setExtendedBindingProperties(org.springframework.cloud.stream.binder.rabbit.properties.RabbitExtendedBindingProperties extendedBindingProperties) |
void |
setNodes(String[] nodes) |
void |
setProducerConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory producerConnectionFactory)
Specify a distinct
ConnectionFactory for the non-transactional producers to avoid dead locks
on blocked connections. |
afterUnbindProducer, doBindConsumer, doBindProducer, errorsBaseName, getDefaultErrorMessageHandler, getErrorBridgeName, getErrorBridgeName, getErrorMessageHandlerName, getErrorRecovererName, registerErrorInfrastructure
afterPropertiesSet, applyPrefix, bindConsumer, bindProducer, buildPartitionRoutingExpression, buildRetryTemplate, constructDLQName, deserializePayloadIfNecessary, deserializePayloadIfNecessary, getApplicationContext, getBeanFactory, groupedName, serializePayloadIfNecessary, serializePayloadIfNecessary, setApplicationContext, setCodec, setIntegrationEvaluationContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bindConsumer, bindProducer
public RabbitMessageChannelBinder(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, org.springframework.boot.autoconfigure.amqp.RabbitProperties rabbitProperties, org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner provisioningProvider)
public void setProducerConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory producerConnectionFactory)
ConnectionFactory
for the non-transactional producers to avoid dead locks
on blocked connections.producerConnectionFactory
- the ConnectionFactory to use for non-transactional producers.public void setDecompressingPostProcessor(org.springframework.amqp.core.MessagePostProcessor decompressingPostProcessor)
MessagePostProcessor
to decompress messages. Defaults to a
DelegatingDecompressingPostProcessor
with its default delegates.decompressingPostProcessor
- the post processor.public void setCompressingPostProcessor(org.springframework.amqp.core.MessagePostProcessor compressingPostProcessor)
MessagePostProcessor
to compress messages.
Defaults to a GZipPostProcessor
.compressingPostProcessor
- the post processor.public void setAdminAddresses(String[] adminAddresses)
public void setNodes(String[] nodes)
public void setExtendedBindingProperties(org.springframework.cloud.stream.binder.rabbit.properties.RabbitExtendedBindingProperties extendedBindingProperties)
public void onInit() throws Exception
AbstractBinder
AbstractBinder.afterPropertiesSet()
which is itself final
.onInit
in class AbstractBinder<org.springframework.messaging.MessageChannel,ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>>
Exception
public void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties getExtendedConsumerProperties(String channelName)
getExtendedConsumerProperties
in interface ExtendedBindingProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties,org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>
public org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties getExtendedProducerProperties(String channelName)
getExtendedProducerProperties
in interface ExtendedBindingProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties,org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>
protected org.springframework.messaging.MessageHandler createProducerMessageHandler(ProducerDestination producerDestination, ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties> producerProperties, org.springframework.messaging.MessageChannel errorChannel)
AbstractMessageChannelBinder
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 sentcreateProducerMessageHandler
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner>
producerDestination
- 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.protected org.springframework.integration.core.MessageProducer createConsumerEndpoint(ConsumerDestination consumerDestination, String group, ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> properties)
AbstractMessageChannelBinder
MessageProducer
that receives data from the consumer destination.
will be started and stopped by the binder.createConsumerEndpoint
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner>
consumerDestination
- reference to the consumer destinationgroup
- the consumer groupproperties
- the consumer propertiesprotected org.springframework.integration.support.ErrorMessageStrategy getErrorMessageStrategy()
AbstractMessageChannelBinder
ErrorMessageStrategy
for building error messages; binder
implementations typically might add extra headers to the error message.getErrorMessageStrategy
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner>
protected org.springframework.messaging.MessageHandler getErrorMessageHandler(ConsumerDestination destination, String group, ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> properties)
AbstractMessageChannelBinder
getErrorMessageHandler
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner>
destination
- the destination.group
- the group.properties
- the properties.protected String errorsBaseName(ConsumerDestination destination, String group, ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> consumerProperties)
errorsBaseName
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner>
protected void afterUnbindConsumer(ConsumerDestination consumerDestination, String group, ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties> consumerProperties)
AbstractMessageChannelBinder
afterUnbindConsumer
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties>,ExtendedProducerProperties<org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties>,org.springframework.cloud.stream.binder.rabbit.provisioning.RabbitExchangeQueueProvisioner>
consumerDestination
- the consumer destinationgroup
- the consumer groupconsumerProperties
- the consumer propertiesCopyright © 2019 Pivotal Software, Inc.. All rights reserved.