public class RabbitMessageChannelBinder extends AbstractMessageChannelBinder<ExtendedConsumerProperties<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>,org.springframework.amqp.core.Queue,org.springframework.amqp.core.Exchange> implements ExtendedPropertiesBinder<org.springframework.messaging.MessageChannel,RabbitConsumerProperties,RabbitProducerProperties>
Binder
implementation backed by RabbitMQ.AbstractBinder.JavaClassMimeTypeConversion
EXPRESSION_PARSER
logger
Constructor and Description |
---|
RabbitMessageChannelBinder(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory,
org.springframework.boot.autoconfigure.amqp.RabbitProperties rabbitProperties) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterUnbindConsumer(String name,
String group,
ExtendedConsumerProperties<RabbitConsumerProperties> consumerProperties)
Invoked after the unbinding of a consumer.
|
protected org.springframework.amqp.core.Queue |
createConsumerDestinationIfNecessary(String name,
String group,
ExtendedConsumerProperties<RabbitConsumerProperties> properties)
Creates the middleware destination the consumer will start to consume data from.
|
protected org.springframework.integration.core.MessageProducer |
createConsumerEndpoint(String name,
String group,
org.springframework.amqp.core.Queue destination,
ExtendedConsumerProperties<RabbitConsumerProperties> properties)
Creates
MessageProducer that receives data from the consumer destination. |
protected org.springframework.amqp.core.Exchange |
createProducerDestinationIfNecessary(String name,
ExtendedProducerProperties<RabbitProducerProperties> producerProperties)
Creates target destinations for outbound channels.
|
protected org.springframework.messaging.MessageHandler |
createProducerMessageHandler(org.springframework.amqp.core.Exchange exchange,
ExtendedProducerProperties<RabbitProducerProperties> properties)
Creates a
MessageHandler with the ability to send data to the
target middleware. |
RabbitConsumerProperties |
getExtendedConsumerProperties(String channelName) |
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(RabbitExtendedBindingProperties extendedBindingProperties) |
void |
setNodes(String[] nodes) |
afterUnbindProducer, doBindConsumer, doBindProducer
afterPropertiesSet, applyPrefix, bindConsumer, bindProducer, buildPartitionRoutingExpression, buildRetryTemplate, constructDLQName, getApplicationContext, getBeanFactory, groupedName, 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)
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(RabbitExtendedBindingProperties extendedBindingProperties)
public void onInit()
AbstractBinder
AbstractBinder.afterPropertiesSet()
which is itself final
.onInit
in class AbstractBinder<org.springframework.messaging.MessageChannel,ExtendedConsumerProperties<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>>
public RabbitConsumerProperties getExtendedConsumerProperties(String channelName)
getExtendedConsumerProperties
in interface ExtendedBindingProperties<RabbitConsumerProperties,RabbitProducerProperties>
public RabbitProducerProperties getExtendedProducerProperties(String channelName)
getExtendedProducerProperties
in interface ExtendedBindingProperties<RabbitConsumerProperties,RabbitProducerProperties>
protected org.springframework.integration.core.MessageProducer createConsumerEndpoint(String name, String group, org.springframework.amqp.core.Queue destination, ExtendedConsumerProperties<RabbitConsumerProperties> properties)
AbstractMessageChannelBinder
MessageProducer
that receives data from the consumer destination.
will be started and stopped by the binder.createConsumerEndpoint
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>,org.springframework.amqp.core.Queue,org.springframework.amqp.core.Exchange>
name
- the name of the target destinationgroup
- the consumer groupdestination
- reference to the consumer destinationproperties
- the consumer propertiesprotected void afterUnbindConsumer(String name, String group, ExtendedConsumerProperties<RabbitConsumerProperties> consumerProperties)
AbstractMessageChannelBinder
afterUnbindConsumer
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>,org.springframework.amqp.core.Queue,org.springframework.amqp.core.Exchange>
name
- the consumer destinationgroup
- the consumer groupconsumerProperties
- the consumer propertiesprotected org.springframework.amqp.core.Queue createConsumerDestinationIfNecessary(String name, String group, ExtendedConsumerProperties<RabbitConsumerProperties> properties)
AbstractMessageChannelBinder
createConsumerDestinationIfNecessary
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>,org.springframework.amqp.core.Queue,org.springframework.amqp.core.Exchange>
name
- the name of the destinationgroup
- the consumer groupproperties
- consumer propertiesprotected org.springframework.amqp.core.Exchange createProducerDestinationIfNecessary(String name, ExtendedProducerProperties<RabbitProducerProperties> producerProperties)
AbstractMessageChannelBinder
createProducerDestinationIfNecessary
in class AbstractMessageChannelBinder<ExtendedConsumerProperties<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>,org.springframework.amqp.core.Queue,org.springframework.amqp.core.Exchange>
name
- the name of the producer destinationproducerProperties
- producer propertiesprotected org.springframework.messaging.MessageHandler createProducerMessageHandler(org.springframework.amqp.core.Exchange exchange, ExtendedProducerProperties<RabbitProducerProperties> properties) throws Exception
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<RabbitConsumerProperties>,ExtendedProducerProperties<RabbitProducerProperties>,org.springframework.amqp.core.Queue,org.springframework.amqp.core.Exchange>
exchange
- the name of the target destinationproperties
- the producer propertiesException
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.