@Singleton
public class EventPublisher
extends java.lang.Object
| Constructor and Description |
|---|
EventPublisher(ConnectionProducer connectionProducer) |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addEvent(net.reini.rabbitmq.cdi.EventKey<T> eventKey,
net.reini.rabbitmq.cdi.PublisherConfiguration<T> configuration)
Adds events of the given type to the CDI events to which the event publisher listens in order
to publish them.
|
void |
cleanUp() |
void |
onEventAfterCompletion(java.lang.Object event)
Observes a CDI event after completion and publishes it to the respective RabbitMQ exchange.
|
void |
onEventAfterFailure(java.lang.Object event)
Observes a CDI event after failure and publishes it to the respective RabbitMQ exchange.
|
void |
onEventAfterSuccess(java.lang.Object event)
Observes a CDI event after success and publishes it to the respective RabbitMQ exchange.
|
void |
onEventBeforeCompletion(java.lang.Object event)
Observes a CDI event before completion and publishes it to the respective RabbitMQ exchange.
|
void |
onEventInProgress(java.lang.Object event)
Observes a CDI event in progress and publishes it to the respective RabbitMQ exchange.
|
@Inject public EventPublisher(ConnectionProducer connectionProducer)
public <T> void addEvent(net.reini.rabbitmq.cdi.EventKey<T> eventKey,
net.reini.rabbitmq.cdi.PublisherConfiguration<T> configuration)
T - The event typeeventKey - The event keyconfiguration - The configuration used when publishing and eventpublic void onEventInProgress(@Observes(during=IN_PROGRESS)
java.lang.Object event)
event - The event to publishpublic void onEventBeforeCompletion(@Observes(during=BEFORE_COMPLETION)
java.lang.Object event)
event - The event to publishpublic void onEventAfterCompletion(@Observes(during=AFTER_COMPLETION)
java.lang.Object event)
event - The event to publishpublic void onEventAfterFailure(@Observes(during=AFTER_FAILURE)
java.lang.Object event)
event - The event to publishpublic void onEventAfterSuccess(@Observes(during=AFTER_SUCCESS)
java.lang.Object event)
event - The event to publishjavax.enterprise.event.ObserverException - if the event could not be delivered to RabbitMQ@PreDestroy public void cleanUp()