public class BrokerEventListener extends java.lang.Object implements org.springframework.amqp.core.MessageListener, org.springframework.context.ApplicationEventPublisherAware, ConnectionListener, org.springframework.context.SmartLifecycle
BrokerEvents. Such events can then
be consumed using an ApplicationListener or @EventListener method.
An AnonymousQueue will be bound to the amq.rabbitmq.event topic exchange
with the supplied keys.| Constructor and Description |
|---|
BrokerEventListener(AbstractMessageListenerContainer container,
java.lang.String... eventKeys)
Construct an instance using the supplied listener container factory and event keys.
|
BrokerEventListener(ConnectionFactory connectionFactory,
java.lang.String... eventKeys)
Construct an instance using the supplied connection factory and event keys.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Exception |
getBindingsFailedException()
Return any exception thrown when attempting to bind the queue to the event exchange.
|
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
onCreate(Connection connection)
Called when a new connection is established.
|
void |
onMessage(org.springframework.amqp.core.Message message) |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
void |
setAutoStartup(boolean autoStartup) |
void |
setPhase(int phase) |
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonClose, onShutDownpublic BrokerEventListener(ConnectionFactory connectionFactory, java.lang.String... eventKeys)
amq.rabbitmq.event topic exchange. They can therefore match wildcards;
examples are user.#, queue.created. Refer to the plugin documentation for
information about available events. A single-threaded
DirectMessageListenerContainer will be created; its lifecycle will be
controlled by this object's SmartLifecycle methods.connectionFactory - the connection factory.eventKeys - the event keys.public BrokerEventListener(AbstractMessageListenerContainer container, java.lang.String... eventKeys)
amq.rabbitmq.event topic exchange. They can therefore match wildcards;
examples are user.#, queue.created. Refer to the plugin documentation for
information about available events. The container's lifecycle will be not be
controlled by this object's SmartLifecycle methods. The container should
not be configured with queues or a MessageListener; those properties will
be replaced.container - the listener container.eventKeys - the event keys.public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware@Nullable public java.lang.Exception getBindingsFailedException()
public void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic int getPhase()
getPhase in interface org.springframework.context.PhasedgetPhase in interface org.springframework.context.SmartLifecyclepublic void setPhase(int phase)
public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setAutoStartup(boolean autoStartup)
public void stop(java.lang.Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic void onMessage(org.springframework.amqp.core.Message message)
onMessage in interface org.springframework.amqp.core.MessageListenerpublic void onCreate(@Nullable
Connection connection)
ConnectionListeneronCreate in interface ConnectionListenerconnection - the connection.