public class RabbitMessageBus extends MessageBusSupport implements org.springframework.beans.factory.DisposableBean
MessageBus
implementation backed by RabbitMQ.MessageBusSupport.DirectHandler, MessageBusSupport.PartitioningMetadata, MessageBusSupport.SetBuilder, MessageBusSupport.SharedChannelProvider<T extends org.springframework.messaging.MessageChannel>
MessageBus.Capability
CONSUMER_RETRY_PROPERTIES, CONSUMER_STANDARD_PROPERTIES, defaultBackOffInitialInterval, defaultBackOffMaxInterval, defaultBackOffMultiplier, defaultBatchBufferLimit, defaultBatchingEnabled, defaultBatchSize, defaultBatchTimeout, defaultCompress, defaultConcurrency, defaultDurableSubscription, defaultMaxAttempts, directChannelProvider, evaluationContext, JOB_CHANNEL_TYPE_PREFIX, MEDIATYPES_MEDIATYPE_ALL, P2P_NAMED_CHANNEL_TYPE_PREFIX, PARTITION_HEADER, PRODUCER_BATCHING_ADVANCED_PROPERTIES, PRODUCER_BATCHING_BASIC_PROPERTIES, PRODUCER_PARTITIONING_PROPERTIES, PRODUCER_STANDARD_PROPERTIES, PUBSUB_NAMED_CHANNEL_TYPE_PREFIX
Constructor and Description |
---|
RabbitMessageBus(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory,
MultiTypeCodec<java.lang.Object> codec) |
Modifier and Type | Method and Description |
---|---|
void |
bindConsumer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleInputChannel,
java.util.Properties properties)
Bind a message consumer on a p2p channel
|
void |
bindProducer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleOutputChannel,
java.util.Properties properties)
Bind a message producer on a p2p channel.
|
void |
bindPubSubConsumer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleInputChannel,
java.util.Properties properties)
Bind a message consumer on a pub/sub channel
|
void |
bindPubSubProducer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleOutputChannel,
java.util.Properties properties)
Bind a message producer on a pub/sub channel.
|
void |
bindReplier(java.lang.String name,
org.springframework.messaging.MessageChannel requests,
org.springframework.messaging.MessageChannel replies,
java.util.Properties properties)
Bind a consumer that handles requests from a requestor and asynchronously sends replies.
|
void |
bindRequestor(java.lang.String name,
org.springframework.messaging.MessageChannel requests,
org.springframework.messaging.MessageChannel replies,
java.util.Properties properties)
Bind a producer that expects async replies.
|
void |
destroy() |
void |
doManualAck(java.util.LinkedList<org.springframework.messaging.MessageHeaders> messageHeadersList)
Perform manual acknowledgement based on the metadata stored in message bus.
|
boolean |
isCapable(MessageBus.Capability capability)
Return true if the bus supports the capability.
|
protected void |
onInit() |
void |
setAddresses(java.lang.String[] addresses) |
void |
setAdminAddresses(java.lang.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 |
setDefaultAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode defaultAcknowledgeMode) |
void |
setDefaultAutoBindDLQ(boolean defaultAutoBindDLQ) |
void |
setDefaultChannelTransacted(boolean defaultChannelTransacted) |
void |
setDefaultDefaultDeliveryMode(org.springframework.amqp.core.MessageDeliveryMode defaultDefaultDeliveryMode) |
void |
setDefaultDefaultRequeueRejected(boolean defaultDefaultRequeueRejected) |
void |
setDefaultMaxConcurrency(int defaultMaxConcurrency)
Set the bus's default max consumers; can be overridden by consumer.maxConcurrency.
|
void |
setDefaultPrefetchCount(int defaultPrefetchCount) |
void |
setDefaultPrefix(java.lang.String defaultPrefix) |
void |
setDefaultReplyHeaderPatterns(java.lang.String[] defaultReplyHeaderPatterns) |
void |
setDefaultRepublishToDLQ(boolean defaultRepublishToDLQ) |
void |
setDefaultRequestHeaderPatterns(java.lang.String[] defaultRequestHeaderPatterns) |
void |
setDefaultTxSize(int defaultTxSize) |
void |
setNodes(java.lang.String[] nodes) |
void |
setPassword(java.lang.String password) |
void |
setSslPropertiesLocation(org.springframework.core.io.Resource sslPropertiesLocation) |
void |
setUsername(java.lang.String username) |
void |
setUseSSL(boolean useSSL) |
void |
setVhost(java.lang.String vhost) |
void |
unbindConsumer(java.lang.String name,
org.springframework.messaging.MessageChannel channel)
Unbind a specific p2p or pub/sub message consumer
|
void |
unbindConsumers(java.lang.String name)
Unbind an inbound inter-module channel and stop any active components that use the channel.
|
addBinding, afterPropertiesSet, applyPrefix, applyPubSub, applyRequests, bindDynamicProducer, bindDynamicPubSubProducer, bindExistingProducerDirectlyIfPossible, bindNewProducerDirectlyIfPossible, buildPartitionRoutingExpression, buildRetryTemplateIfRetryEnabled, constructDLQName, deleteBinding, deleteBindings, deserializePayloadIfNecessary, deserializePayloadIfNecessary, determinePartition, doBindDynamicProducer, doBindDynamicPubSubProducer, getApplicationContext, getBeanFactory, getIdGenerator, isNamedChannel, serializePayloadIfNecessary, setApplicationContext, setCodec, setDefaultBackOffInitialInterval, setDefaultBackOffMaxInterval, setDefaultBackOffMultiplier, setDefaultBatchBufferLimit, setDefaultBatchingEnabled, setDefaultBatchSize, setDefaultBatchTimeout, setDefaultCompress, setDefaultConcurrency, setDefaultDurableSubscription, setDefaultMaxAttempts, setIntegrationEvaluationContext, setPartitionSelector, stopBindings, unbindProducer, unbindProducers, validateConsumerProperties, validateProducerProperties
public RabbitMessageBus(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, MultiTypeCodec<java.lang.Object> codec)
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 setDefaultAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode defaultAcknowledgeMode)
public void setDefaultChannelTransacted(boolean defaultChannelTransacted)
public void setDefaultDefaultDeliveryMode(org.springframework.amqp.core.MessageDeliveryMode defaultDefaultDeliveryMode)
public void setDefaultDefaultRequeueRejected(boolean defaultDefaultRequeueRejected)
public void setDefaultMaxConcurrency(int defaultMaxConcurrency)
defaultMaxConcurrency
- The default max concurrency.public void setDefaultPrefetchCount(int defaultPrefetchCount)
public void setDefaultTxSize(int defaultTxSize)
public void setDefaultPrefix(java.lang.String defaultPrefix)
public void setDefaultRequestHeaderPatterns(java.lang.String[] defaultRequestHeaderPatterns)
public void setDefaultReplyHeaderPatterns(java.lang.String[] defaultReplyHeaderPatterns)
public void setDefaultAutoBindDLQ(boolean defaultAutoBindDLQ)
public void setDefaultRepublishToDLQ(boolean defaultRepublishToDLQ)
public void setAddresses(java.lang.String[] addresses)
public void setAdminAddresses(java.lang.String[] adminAddresses)
public void setNodes(java.lang.String[] nodes)
public void setUsername(java.lang.String username)
public void setPassword(java.lang.String password)
public void setVhost(java.lang.String vhost)
public void setUseSSL(boolean useSSL)
public void setSslPropertiesLocation(org.springframework.core.io.Resource sslPropertiesLocation)
protected void onInit()
onInit
in class MessageBusSupport
public void bindConsumer(java.lang.String name, org.springframework.messaging.MessageChannel moduleInputChannel, java.util.Properties properties)
MessageBus
bindConsumer
in interface MessageBus
name
- the logical identity of the message sourcemoduleInputChannel
- the channel bound as a consumerproperties
- arbitrary String key/value pairs that will be used in the bindingpublic void bindPubSubConsumer(java.lang.String name, org.springframework.messaging.MessageChannel moduleInputChannel, java.util.Properties properties)
MessageBus
bindPubSubConsumer
in interface MessageBus
name
- the logical identity of the message sourcemoduleInputChannel
- the channel bound as a pub/sub consumerproperties
- arbitrary String key/value pairs that will be used in the bindingpublic void bindProducer(java.lang.String name, org.springframework.messaging.MessageChannel moduleOutputChannel, java.util.Properties properties)
MessageBus
bindProducer
in interface MessageBus
name
- the logical identity of the message targetmoduleOutputChannel
- the channel bound as a producerproperties
- arbitrary String key/value pairs that will be used in the bindingpublic void bindPubSubProducer(java.lang.String name, org.springframework.messaging.MessageChannel moduleOutputChannel, java.util.Properties properties)
MessageBus
bindPubSubProducer
in interface MessageBus
name
- the logical identity of the message targetmoduleOutputChannel
- the channel bound as a producerproperties
- arbitrary String key/value pairs that will be used in the bindingpublic void bindRequestor(java.lang.String name, org.springframework.messaging.MessageChannel requests, org.springframework.messaging.MessageChannel replies, java.util.Properties properties)
MessageBus
bindRequestor
in interface MessageBus
name
- The name of the requestor.requests
- The request channel - sends requests.replies
- The reply channel - receives replies.properties
- arbitrary String key/value pairs that will be used in the binding.public void bindReplier(java.lang.String name, org.springframework.messaging.MessageChannel requests, org.springframework.messaging.MessageChannel replies, java.util.Properties properties)
MessageBus
bindReplier
in interface MessageBus
name
- The name of the requestor for which this replier will handle requests.requests
- The request channel - receives requests.replies
- The reply channel - sends replies.properties
- arbitrary String key/value pairs that will be used in the binding.public void unbindConsumer(java.lang.String name, org.springframework.messaging.MessageChannel channel)
MessageBus
unbindConsumer
in interface MessageBus
unbindConsumer
in class MessageBusSupport
name
- The logical identify of a message sourcechannel
- The channel bound as a consumerpublic void unbindConsumers(java.lang.String name)
MessageBus
unbindConsumers
in interface MessageBus
unbindConsumers
in class MessageBusSupport
name
- the channel namepublic boolean isCapable(MessageBus.Capability capability)
MessageBus
isCapable
in interface MessageBus
isCapable
in class MessageBusSupport
capability
- the capability.public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
public void doManualAck(java.util.LinkedList<org.springframework.messaging.MessageHeaders> messageHeadersList)
MessageBusSupport
doManualAck
in class MessageBusSupport