public class LocalMessageBus extends MessageBusSupport implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
MessageBus
for in-process use. For inbound and outbound, creates a
DirectChannel
or a QueueChannel
depending on whether the binding is aliased or not then bridges the
passed MessageChannel
to the channel which is registered in the given application context. If that channel
does not yet exist, it will be created.logger, MEDIATYPES_MEDIATYPE_ALL, ORIGINAL_CONTENT_TYPE_HEADER
Constructor and Description |
---|
LocalMessageBus() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
bindConsumer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleInputChannel,
boolean aliasHint)
Looks up or creates a DirectChannel with the given name and creates a bridge from that channel to the provided
channel instance.
|
void |
bindProducer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleOutputChannel,
boolean aliasHint)
Looks up or creates a DirectChannel with the given name and creates a bridge to that channel from the provided
channel instance.
|
void |
bindPubSubConsumer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleInputChannel)
Bind a message consumer on a pub/sub channel
|
void |
bindPubSubProducer(java.lang.String name,
org.springframework.messaging.MessageChannel moduleOutputChannel)
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)
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)
Bind a producer that expects async replies.
|
protected org.springframework.integration.handler.BridgeHandler |
bridge(org.springframework.messaging.MessageChannel from,
org.springframework.messaging.MessageChannel to,
java.lang.String bridgeName) |
protected org.springframework.integration.handler.BridgeHandler |
bridge(org.springframework.messaging.MessageChannel from,
org.springframework.messaging.MessageChannel to,
java.lang.String bridgeName,
java.util.Collection<org.springframework.http.MediaType> acceptedMediaTypes) |
protected <T extends org.springframework.integration.channel.AbstractMessageChannel> |
createSharedChannel(java.lang.String name,
java.lang.Class<T> requiredType) |
protected <T> T |
getBean(java.lang.String name,
java.lang.Class<T> requiredType) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setPoller(org.springframework.integration.scheduling.PollerMetadata poller)
Set the poller to use when QueueChannels are used.
|
void |
setQueueSize(int queueSize)
Set the size of the queue when using
QueueChannel s. |
void |
unbindProducer(java.lang.String name,
org.springframework.messaging.MessageChannel channel)
Unbind a specific p2p or pub/sub message producer
|
addBinding, deleteBinding, deleteBindings, deserializePayloadIfNecessary, getBeanFactory, getIdGenerator, serializePayloadIfNecessary, setBeanFactory, setCodec, stopBindings, unbindConsumer, unbindConsumers, unbindProducers
public void setQueueSize(int queueSize)
QueueChannel
s.public void setPoller(org.springframework.integration.scheduling.PollerMetadata poller)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void bindConsumer(java.lang.String name, org.springframework.messaging.MessageChannel moduleInputChannel, boolean aliasHint)
bindConsumer
in interface MessageBus
name
- the logical identity of the message sourcemoduleInputChannel
- the channel bound as a consumeraliasHint
- whether the provided name represents an alias and thus should support late bindingpublic void bindPubSubConsumer(java.lang.String name, org.springframework.messaging.MessageChannel moduleInputChannel)
MessageBus
bindPubSubConsumer
in interface MessageBus
name
- the logical identity of the message sourcemoduleInputChannel
- the channel bound as a pub/sub consumerpublic void bindProducer(java.lang.String name, org.springframework.messaging.MessageChannel moduleOutputChannel, boolean aliasHint)
bindProducer
in interface MessageBus
name
- the logical identity of the message targetmoduleOutputChannel
- the channel bound as a produceraliasHint
- whether the provided name represents an alias and thus should support late bindingpublic void bindPubSubProducer(java.lang.String name, org.springframework.messaging.MessageChannel moduleOutputChannel)
MessageBus
bindPubSubProducer
in interface MessageBus
name
- the logical identity of the message targetmoduleOutputChannel
- the channel bound as a producerpublic void bindRequestor(java.lang.String name, org.springframework.messaging.MessageChannel requests, org.springframework.messaging.MessageChannel replies)
MessageBus
bindRequestor
in interface MessageBus
name
- The name of the requestor.requests
- The request channel - sends requests.replies
- The reply channel - receives replies.public void bindReplier(java.lang.String name, org.springframework.messaging.MessageChannel requests, org.springframework.messaging.MessageChannel replies)
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.public void unbindProducer(java.lang.String name, org.springframework.messaging.MessageChannel channel)
MessageBus
unbindProducer
in interface MessageBus
unbindProducer
in class MessageBusSupport
name
- the logical identity of the message targetchannel
- the channel bound as a producerprotected <T extends org.springframework.integration.channel.AbstractMessageChannel> T createSharedChannel(java.lang.String name, java.lang.Class<T> requiredType)
protected org.springframework.integration.handler.BridgeHandler bridge(org.springframework.messaging.MessageChannel from, org.springframework.messaging.MessageChannel to, java.lang.String bridgeName)
protected org.springframework.integration.handler.BridgeHandler bridge(org.springframework.messaging.MessageChannel from, org.springframework.messaging.MessageChannel to, java.lang.String bridgeName, java.util.Collection<org.springframework.http.MediaType> acceptedMediaTypes)
protected <T> T getBean(java.lang.String name, java.lang.Class<T> requiredType)