|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventhandling.amqp.spring.SpringAMQPTerminal
public class SpringAMQPTerminal
EventBusTerminal implementation that uses an AMQP 0.9 compatible Message Broker to dispatch event messages. All outgoing messages are sent to a configured Exchange, which defaults to .
This terminal does not dispatch Events internally, as it relies on each cluster to listen to it's own AMQP Queue.
Constructor Summary | |
---|---|
SpringAMQPTerminal()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected void |
doSendMessage(com.rabbitmq.client.Channel channel,
AMQPMessage amqpMessage)
Does the actual publishing of the given body on the given channel . |
void |
onClusterCreated(Cluster cluster)
Invoked when an Event Listener has been assigned to a cluster that was not yet known to the Event Bus. |
void |
publish(EventMessage... events)
Publishes the given events to all clusters on the Event Bus. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
Sets the ConnectionFactory providing the Connections and Channels to send messages on. |
void |
setDurable(boolean durable)
Whether or not messages should be marked as "durable" when sending them out. |
void |
setExchange(org.springframework.amqp.core.Exchange exchange)
Sets the name of the exchange to dispatch published messages to. |
void |
setExchangeName(String exchangeName)
Sets the name of the exchange to dispatch published messages to. |
void |
setListenerContainerLifecycleManager(ListenerContainerLifecycleManager listenerContainerLifecycleManager)
Sets the ListenerContainerLifecycleManager that creates and manages the lifecycle of Listener Containers for the clusters that are connected to this terminal. |
void |
setMessageConverter(AMQPMessageConverter messageConverter)
Sets the Message Converter that creates AMQP Messages from Event Messages and vice versa. |
void |
setPublisherAckTimeout(long publisherAckTimeout)
Sets the maximum amount of time (in milliseconds) the publisher may wait for the acknowledgement of published messages. |
void |
setRoutingKeyResolver(RoutingKeyResolver routingKeyResolver)
Sets the RoutingKeyResolver that provides the Routing Key for each message to dispatch. |
void |
setSerializer(Serializer serializer)
Sets the serializer to serialize messages with when sending them to the Exchange. |
void |
setTransactional(boolean transactional)
Whether this Terminal should dispatch its Events in a transaction or not. |
void |
setWaitForPublisherAck(boolean waitForPublisherAck)
Enables or diables the RabbitMQ specific publisher acknowledgements (confirms). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpringAMQPTerminal()
Method Detail |
---|
public void publish(EventMessage... events)
EventBusTerminal
events
to all clusters on the Event Bus. The terminal is responsible for the
delivery process, albeit local or remote.
publish
in interface EventBusTerminal
events
- the collections of events to publishprotected void doSendMessage(com.rabbitmq.client.Channel channel, AMQPMessage amqpMessage) throws IOException
body
on the given channel
. This method can be
overridden to change the properties used to send a message.
channel
- The channel to dispatch the message onamqpMessage
- The AMQPMessage describing the characteristics of the message to publish
IOException
- when an error occurs while writing the messagepublic void onClusterCreated(Cluster cluster)
EventBusTerminal
onClusterCreated
in interface EventBusTerminal
cluster
- the newly created clusterpublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void setTransactional(boolean transactional)
false
.
If a delegate Terminal is configured, the transaction will be committed after the delegate has
dispatched the events.
Transactional behavior cannot be enabled if setWaitForPublisherAck(boolean)
has been set to
true
.
transactional
- whether dispatching should be transactional or notpublic void setWaitForPublisherAck(boolean waitForPublisherAck)
waitForPublisherAck
- whether or not to enab;e server acknowledgements (confirms)public void setPublisherAckTimeout(long publisherAckTimeout)
setWaitForPublisherAck(boolean)
is set to true
.
publisherAckTimeout
- The number of milliseconds to wait for confirms, or 0 to wait indefinitely.public void setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
publish(org.axonframework.domain.EventMessage[])
Defaults to an autowired Connection Factory.
connectionFactory
- The connection factory to setpublic void setMessageConverter(AMQPMessageConverter messageConverter)
messageConverter
- The message converter to convert AMQP Messages to Event Messages and vice versa.public void setDurable(boolean durable)
MessageConverter
is provided.
In that case, the message converter must add the properties to reflect the required durability setting.
durable
- whether or not messages should be durablepublic void setSerializer(Serializer serializer)
MessageConverter
is configured.
serializer
- the serializer to serialize message withpublic void setRoutingKeyResolver(RoutingKeyResolver routingKeyResolver)
PackageRoutingKeyResolver
, which uses the package name of the message's
payload as a Routing Key.
This setting is ignored if a MessageConverter
is configured.
routingKeyResolver
- the RoutingKeyResolver to usepublic void setExchangeName(String exchangeName)
exchangeName
- the name of the exchange to dispatch messages topublic void setExchange(org.springframework.amqp.core.Exchange exchange)
exchange
- the exchange to dispatch messages topublic void setListenerContainerLifecycleManager(ListenerContainerLifecycleManager listenerContainerLifecycleManager)
listenerContainerLifecycleManager
- the listenerContainerLifecycleManager to setpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |