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.
original
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRabbitMQPublisher
(io.vertx.rabbitmq.RabbitMQPublisher delegate) RabbitMQPublisher
(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionstatic RabbitMQPublisher
create
(Vertx vertx, RabbitMQClient client, io.vertx.rabbitmq.RabbitMQPublisherOptions options) boolean
ReadStream<io.vertx.rabbitmq.RabbitMQPublisherConfirmation>
io.vertx.rabbitmq.RabbitMQPublisher
int
hashCode()
static RabbitMQPublisher
newInstance
(io.vertx.rabbitmq.RabbitMQPublisher arg) io.smallrye.mutiny.Uni<Void>
publish
(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message.publishAndAwait
(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Blocking variant ofpublish(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
.void
publishAndForget
(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Variant ofpublish(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Long>
publishConfirm
(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message and complete when publish confirm has returned.publishConfirmAndAwait
(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Blocking variant ofpublishConfirm(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
.void
publishConfirmAndForget
(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Variant ofpublishConfirm(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.int
void
restart()
io.smallrye.mutiny.Uni<Void>
start()
Start the rabbitMQ publisher.Blocking variant ofstart()
.void
Variant ofstart()
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
stop()
Stop the rabbitMQ publisher.Blocking variant ofstop()
.void
Variant ofstop()
that ignores the result of the operation.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
RabbitMQPublisher
public RabbitMQPublisher(io.vertx.rabbitmq.RabbitMQPublisher delegate) -
RabbitMQPublisher
-
-
Method Details
-
getDelegate
public io.vertx.rabbitmq.RabbitMQPublisher getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
create
public static RabbitMQPublisher create(Vertx vertx, RabbitMQClient client, io.vertx.rabbitmq.RabbitMQPublisherOptions options) - Parameters:
vertx
- the vertx instance.client
- the RabbitMQClient.options
- options for the publisher.- Returns:
- the publisher
-
start
Start the rabbitMQ publisher. The RabbitMQClient should have been started before this.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
startAndAwait
Blocking variant ofstart()
.This method waits 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 a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
startAndForget
public void startAndForget() -
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
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
stopAndAwait
Blocking variant ofstop()
.This method waits 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 a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
stopAndForget
public void stopAndForget() -
restart
public void restart() -
getConfirmationStream
- Returns:
- the ReadStream that contains the message IDs for confirmed messages.
-
queueSize
public int queueSize()- Returns:
- the number of published, but not sent, messages.
-
publish
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> publish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
exchange
-routingKey
-properties
-body
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
publishAndAwait
public Void publishAndAwait(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Blocking variant ofpublish(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
.This method waits 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 a RuntimeException).
- Parameters:
exchange
-routingKey
-properties
-body
-- Returns:
- the Void instance produced by the operation.
-
publishAndForget
public void publishAndForget(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Variant ofpublish(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
publish(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompublish(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Parameters:
exchange
-routingKey
-properties
-body
-
-
publishConfirm
@CheckReturnValue public io.smallrye.mutiny.Uni<Long> publishConfirm(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message and complete when publish confirm has returned.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
exchange
-routingKey
-properties
-body
-- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
publishConfirmAndAwait
public Long publishConfirmAndAwait(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Blocking variant ofpublishConfirm(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
.This method waits 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 a RuntimeException).
- Parameters:
exchange
-routingKey
-properties
-body
-- Returns:
- the Long instance produced by the operation.
-
publishConfirmAndForget
public void publishConfirmAndForget(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Variant ofpublishConfirm(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
that ignores the result of the operation.This method subscribes on the result of
publishConfirm(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frompublishConfirm(String,String,BasicProperties,io.vertx.mutiny.core.buffer.Buffer)
but you don't need to compose it with other operations.- Parameters:
exchange
-routingKey
-properties
-body
-
-
newInstance
-