Interface RabbitMQPublisher
public interface RabbitMQPublisher
A reliable publisher that
- Queues up messages internally until it can successfully call basicPublish.
- Notifies the caller using a robust ID (not delivery tag) when the message is confirmed by rabbit.
- Author:
- jtalbut
-
Method Summary
Modifier and TypeMethodDescriptionstatic RabbitMQPublishercreate(Vertx vertx, RabbitMQClient client, RabbitMQPublisherOptions options) Create and return a publisher using the specified client.Get the ReadStream that contains the message IDs for confirmed messages.publish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message.publishConfirm(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message and complete when publish confirm has returned.intGet the number of published, but not sent, messages.voidrestart()Undo the effects of callingso that publish may be called again.invalid reference
#stop(Handler)start()Start the rabbitMQ publisher.stop()Stop the rabbitMQ publisher.
-
Method Details
-
create
static RabbitMQPublisher create(Vertx vertx, RabbitMQClient client, RabbitMQPublisherOptions options) Create and return a publisher using the specified client.- Parameters:
vertx- the vertx instance.client- the RabbitMQClient.options- options for the publisher.- Returns:
- the publisher
-
start
-
stop
-
restart
void restart()Undo the effects of callingso that publish may be called again. It is harmless to call restart() wheninvalid reference
#stop(Handler)has not been called, however if restart() is called whilstinvalid reference
#stop(Handler)is being processed theinvalid reference
#stop(Handler)will never complete.invalid reference
#stop(Handler) -
getConfirmationStream
ReadStream<RabbitMQPublisherConfirmation> getConfirmationStream()Get the ReadStream that contains the message IDs for confirmed messages. The message IDs in this ReadStream are taken from the message properties, if these message IDs are not set then this ReadStream will contain nulls and using this publisher will be pointless.- Returns:
- the ReadStream that contains the message IDs for confirmed messages.
-
publish
-
publishConfirm
-
queueSize
int queueSize()Get the number of published, but not sent, messages.- Returns:
- the number of published, but not sent, messages.
-