public class GenericPublisher extends java.lang.Object implements MessagePublisher
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_RETRY_ATTEMPTS |
static int |
DEFAULT_RETRY_INTERVAL |
| Constructor and Description |
|---|
GenericPublisher(ConnectionProducer connectionProducer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the publisher by closing its underlying channel.
|
protected void |
handleIoException(int attempt,
java.lang.Throwable cause)
Handles an exception depending on the already used attempts to send a message.
|
void |
publish(java.lang.Object event,
net.reini.rabbitmq.cdi.PublisherConfiguration<?> publisherConfiguration)
Publishes the given event using the given publisher configuration template.
|
protected void |
sleepBeforeRetry() |
public static final int DEFAULT_RETRY_ATTEMPTS
public static final int DEFAULT_RETRY_INTERVAL
public GenericPublisher(ConnectionProducer connectionProducer)
protected void handleIoException(int attempt,
java.lang.Throwable cause)
throws PublishException
attempt - Current attempt countcause - The thrown exceptionPublishException - if the maximum amount of attempts is exceededprotected void sleepBeforeRetry()
public void publish(java.lang.Object event,
net.reini.rabbitmq.cdi.PublisherConfiguration<?> publisherConfiguration)
throws PublishException
MessagePublisherpublish in interface MessagePublisherevent - the event being published to RabbitMQpublisherConfiguration - the default publisher configurationPublishException - if the event could not be delivered to RabbitMQpublic void close()
close in interface MessagePublisher