Class RabbitMQPublisher
- All Implemented Interfaces:
MutinyDelegate
- 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.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- jtalbut
- See Also:
-
RabbitMQPublisher
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRabbitMQPublisher(io.vertx.rabbitmq.RabbitMQPublisher delegate) Create a new instance ofRabbitMQPublisherdelegating to the given (non-null) instance ofRabbitMQPublisher.RabbitMQPublisher(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionstatic RabbitMQPublishercreate(Vertx vertx, RabbitMQClient client, io.vertx.rabbitmq.RabbitMQPublisherOptions options) Create and return a publisher using the specified client.booleanReadStream<io.vertx.rabbitmq.RabbitMQPublisherConfirmation>Get the ReadStream that contains the message IDs for confirmed messages.io.vertx.rabbitmq.RabbitMQPublisherGet the delegate instance.inthashCode()static RabbitMQPublishernewInstance(io.vertx.rabbitmq.RabbitMQPublisher delegate) Creates a new instance of theRabbitMQPublisher.io.smallrye.mutiny.Uni<Void>publish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message.voidpublishAndAwait(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message.publishAndForget(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message.io.smallrye.mutiny.Uni<Long>publishConfirm(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message and complete when publish confirm has returned.publishConfirmAndAwait(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message and complete when publish confirm has returned.publishConfirmAndForget(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.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 calling#stop(Handler)so that publish may be called again.io.smallrye.mutiny.Uni<Void>start()Start the rabbitMQ publisher.voidStart the rabbitMQ publisher.Start the rabbitMQ publisher.io.smallrye.mutiny.Uni<Void>stop()Stop the rabbitMQ publisher.voidStop the rabbitMQ publisher.Stop the rabbitMQ publisher.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
RabbitMQPublisher
public RabbitMQPublisher(io.vertx.rabbitmq.RabbitMQPublisher delegate) Create a new instance ofRabbitMQPublisherdelegating to the given (non-null) instance ofRabbitMQPublisher. -
RabbitMQPublisher
-
-
Method Details
-
getDelegate
public io.vertx.rabbitmq.RabbitMQPublisher getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
start
Start the rabbitMQ publisher. The RabbitMQClient should have been started before this.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
RabbitMQPublisher.start()
-
startAndAwait
public void startAndAwait()Start the rabbitMQ publisher. The RabbitMQClient should have been started before this.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
RabbitMQPublisher.start()
-
startAndForget
Start the rabbitMQ publisher. The RabbitMQClient should have been started before this.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
RabbitMQPublisher.start()
-
stop
Stop the rabbitMQ publisher. Calling this is optional, but it gives the opportunity to drain the send queue without losing messages. Future calls to publish will be ignored.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
RabbitMQPublisher.stop()
-
stopAndAwait
public void stopAndAwait()Stop the rabbitMQ publisher. Calling this is optional, but it gives the opportunity to drain the send queue without losing messages. Future calls to publish will be ignored.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
RabbitMQPublisher.stop()
-
stopAndForget
Stop the rabbitMQ publisher. Calling this is optional, but it gives the opportunity to drain the send queue without losing messages. Future calls to publish will be ignored.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
RabbitMQPublisher.stop()
-
publish
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> publish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Channel.basicPublish(String, String, AMQP.BasicProperties, byte[])RabbitMQPublisher.publish(String, String, BasicProperties, Buffer)
-
publishAndAwait
public void publishAndAwait(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
Channel.basicPublish(String, String, AMQP.BasicProperties, byte[])RabbitMQPublisher.publish(String, String, BasicProperties, Buffer)
-
publishAndForget
public RabbitMQPublisher publishAndForget(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Channel.basicPublish(String, String, AMQP.BasicProperties, byte[])RabbitMQPublisher.publish(String, String, BasicProperties, Buffer)
-
publishConfirm
@CheckReturnValue public io.smallrye.mutiny.Uni<Long> publishConfirm(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message and complete when publish confirm has returned.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Channel.basicPublish(String, String, AMQP.BasicProperties, byte[])RabbitMQPublisher.publishConfirm(String, String, BasicProperties, Buffer)
-
publishConfirmAndAwait
public Long publishConfirmAndAwait(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message and complete when publish confirm has returned.Unlike the bare Vert.x variant, this method returns a
Long. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Returns:
- The operation result
- See Also:
-
Channel.basicPublish(String, String, AMQP.BasicProperties, byte[])RabbitMQPublisher.publishConfirm(String, String, BasicProperties, Buffer)
-
publishConfirmAndForget
public RabbitMQPublisher publishConfirmAndForget(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, io.vertx.core.buffer.Buffer body) Publish a message and complete when publish confirm has returned.Unlike the bare Vert.x variant, this method ignores the
Longresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Channel.basicPublish(String, String, AMQP.BasicProperties, byte[])RabbitMQPublisher.publishConfirm(String, String, BasicProperties, Buffer)
-
create
public static RabbitMQPublisher create(Vertx vertx, RabbitMQClient client, io.vertx.rabbitmq.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
-
restart
public void restart()Undo the effects of calling#stop(Handler)so that publish may be called again. It is harmless to call restart() when#stop(Handler)has not been called, however if restart() is called whilst#stop(Handler)is being processed the#stop(Handler)will never complete. -
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.
-
queueSize
public int queueSize()Get the number of published, but not sent, messages.- Returns:
- the number of published, but not sent, messages.
-
newInstance
Creates a new instance of theRabbitMQPublisher. -
hashCode
public int hashCode() -
equals
-
toString
-