Class RabbitMQClient
java.lang.Object
io.vertx.reactivex.rabbitmq.RabbitMQClient
- All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConfirmListener(int maxQueueSize) Add a Confirm Listener to the channel.basicAck(long deliveryTag, boolean multiple) Acknowledge one or several received messages.basicConsumer(String queue) basicConsumer(String queue, QueueOptions options) Create a consumer with the givenoptions.Retrieve a message from a queue using AMQP.Basic.GetbasicNack(long deliveryTag, boolean multiple, boolean requeue) Reject one or several received messages.basicPublish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message.basicPublish(String exchange, String routingKey, Buffer body) Publish a message.basicPublishWithDeliveryTag(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body, Handler<Long> deliveryTagHandler) Publish a message.basicQos(int prefetchCount) Request a specific prefetchCount "quality of service" settings for this channel.basicQos(int prefetchCount, boolean global) Request a specific prefetchCount "quality of service" settings for this channel.basicQos(int prefetchSize, int prefetchCount, boolean global) Request specific "quality of service" settings.Enables publisher acknowledgements on this channel.static RabbitMQClientCreate and return a client configured with the default options.static RabbitMQClientcreate(Vertx vertx, RabbitMQOptions config) Create and return a client.booleanexchangeBind(String destination, String source, String routingKey) Bind an exchange to an exchange.Bind an exchange to an exchange.exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete) Declare an exchange.exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, JsonObject config) Declare an exchange with additional parameters such as dead lettering, an alternate exchange or TTL.exchangeDelete(String exchange) Delete an exchange, without regard for whether it is in use or not.exchangeUnbind(String destination, String source, String routingKey) Unbind an exchange from an exchange.Unbind an exchange from an exchange.inthashCode()booleanCheck if a connection is openbooleanCheck if a channel is openmessageCount(String queue) Returns the number of messages in a queue ready to be delivered.static RabbitMQClientBind a queue to an exchangeBind a queue to an exchangeFuture<com.rabbitmq.client.AMQP.Queue.DeclareOk> queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete) Declare a queueFuture<com.rabbitmq.client.AMQP.Queue.DeclareOk> queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, JsonObject config) Declare a queue with config optionsActively declare a server-named exclusive, autodelete, non-durable queue.Future<com.rabbitmq.client.AMQP.Queue.DeleteOk> queueDelete(String queue) Delete a queue, without regard for whether it is in use or has messages on itFuture<com.rabbitmq.client.AMQP.Queue.DeleteOk> queueDeleteIf(String queue, boolean ifUnused, boolean ifEmpty) Delete a queuequeueUnbind(String queue, String exchange, String routingKey) Unbind a queue from an exchangeUnbind a queue from an exchangerestartConnect(int attempts) restart the rabbitMQ connect.rxAddConfirmListener(int maxQueueSize) Add a Confirm Listener to the channel.rxBasicAck(long deliveryTag, boolean multiple) Acknowledge one or several received messages.rxBasicConsumer(String queue) rxBasicConsumer(String queue, QueueOptions options) Create a consumer with the givenoptions.rxBasicGet(String queue, boolean autoAck) Retrieve a message from a queue using AMQP.Basic.GetrxBasicNack(long deliveryTag, boolean multiple, boolean requeue) Reject one or several received messages.rxBasicPublish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message.rxBasicPublish(String exchange, String routingKey, Buffer body) Publish a message.rxBasicPublishWithDeliveryTag(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body, Handler<Long> deliveryTagHandler) Publish a message.rxBasicQos(int prefetchCount) Request a specific prefetchCount "quality of service" settings for this channel.rxBasicQos(int prefetchCount, boolean global) Request a specific prefetchCount "quality of service" settings for this channel.rxBasicQos(int prefetchSize, int prefetchCount, boolean global) Request specific "quality of service" settings.Enables publisher acknowledgements on this channel.rxExchangeBind(String destination, String source, String routingKey) Bind an exchange to an exchange.Bind an exchange to an exchange.rxExchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete) Declare an exchange.rxExchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, JsonObject config) Declare an exchange with additional parameters such as dead lettering, an alternate exchange or TTL.rxExchangeDelete(String exchange) Delete an exchange, without regard for whether it is in use or not.rxExchangeUnbind(String destination, String source, String routingKey) Unbind an exchange from an exchange.rxExchangeUnbind(String destination, String source, String routingKey, Map<String, Object> arguments) Unbind an exchange from an exchange.rxMessageCount(String queue) Returns the number of messages in a queue ready to be delivered.rxQueueBind(String queue, String exchange, String routingKey) Bind a queue to an exchangeBind a queue to an exchangeSingle<com.rabbitmq.client.AMQP.Queue.DeclareOk> rxQueueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete) Declare a queueSingle<com.rabbitmq.client.AMQP.Queue.DeclareOk> rxQueueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, JsonObject config) Declare a queue with config optionsActively declare a server-named exclusive, autodelete, non-durable queue.Single<com.rabbitmq.client.AMQP.Queue.DeleteOk> rxQueueDelete(String queue) Delete a queue, without regard for whether it is in use or has messages on itSingle<com.rabbitmq.client.AMQP.Queue.DeleteOk> rxQueueDeleteIf(String queue, boolean ifUnused, boolean ifEmpty) Delete a queuerxQueueUnbind(String queue, String exchange, String routingKey) Unbind a queue from an exchangeUnbind a queue from an exchangerxRestartConnect(int attempts) restart the rabbitMQ connect.rxStart()Start the rabbitMQ client.rxStop()Stop the rabbitMQ client.Wait until all messages published since the last call have been either ack'd or nack'd by the broker.rxWaitForConfirms(long timeout) Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses.start()Start the rabbitMQ client.stop()Stop the rabbitMQ client.toString()Wait until all messages published since the last call have been either ack'd or nack'd by the broker.waitForConfirms(long timeout) Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses.
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
RabbitMQClient
-
RabbitMQClient
-
-
Method Details
-
toString
-
equals
-
hashCode
-
getDelegate
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
create
Create and return a client configured with the default options.- Parameters:
vertx- the vertx instance- Returns:
- the client
-
create
Create and return a client.- Parameters:
vertx- the vertx instanceconfig- the client config- Returns:
- the client
-
basicAck
-
rxBasicAck
Acknowledge one or several received messages. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being acknowledged.- Parameters:
deliveryTag-multiple-- Returns:
-
basicNack
-
rxBasicNack
Reject one or several received messages.- Parameters:
deliveryTag-multiple-requeue-- Returns:
-
basicGet
Retrieve a message from a queue using AMQP.Basic.Get- Parameters:
queue-autoAck-- Returns:
-
rxBasicGet
Retrieve a message from a queue using AMQP.Basic.Get- Parameters:
queue-autoAck-- Returns:
-
basicConsumer
- Parameters:
queue-- Returns:
-
rxBasicConsumer
- Parameters:
queue-- Returns:
-
basicConsumer
Create a consumer with the givenoptions.- Parameters:
queue- the name of a queueoptions- options for queue- Returns:
- a future completed with the operation status; if the operation succeeds you can begin to receive messages through an instance of
RabbitMQConsumer
-
rxBasicConsumer
Create a consumer with the givenoptions.- Parameters:
queue- the name of a queueoptions- options for queue- Returns:
- a future completed with the operation status; if the operation succeeds you can begin to receive messages through an instance of
RabbitMQConsumer
-
basicPublish
Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.- Parameters:
exchange-routingKey-body-- Returns:
-
rxBasicPublish
Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.- Parameters:
exchange-routingKey-body-- Returns:
-
addConfirmListener
Add a Confirm Listener to the channel. Note that this will automatically call confirmSelect, it is not necessary to call that too.- Parameters:
maxQueueSize- maximum size of the queue of confirmations- Returns:
- a future completed with a stream of confirmations if the operation succeeds
-
rxAddConfirmListener
Add a Confirm Listener to the channel. Note that this will automatically call confirmSelect, it is not necessary to call that too.- Parameters:
maxQueueSize- maximum size of the queue of confirmations- Returns:
- a future completed with a stream of confirmations if the operation succeeds
-
confirmSelect
-
rxConfirmSelect
Enables publisher acknowledgements on this channel. Can be called once during client initialisation. Calls to basicPublish() will have to be confirmed.- Returns:
-
waitForConfirms
Wait until all messages published since the last call have been either ack'd or nack'd by the broker. This will incur slight performance loss at the expense of higher write consistency. If desired, multiple calls to basicPublish() can be batched before confirming.- Returns:
-
rxWaitForConfirms
Wait until all messages published since the last call have been either ack'd or nack'd by the broker. This will incur slight performance loss at the expense of higher write consistency. If desired, multiple calls to basicPublish() can be batched before confirming.- Returns:
-
waitForConfirms
-
rxWaitForConfirms
Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses. If the timeout expires a TimeoutException is thrown.- Parameters:
timeout-- Returns:
-
basicQos
-
rxBasicQos
Request a specific prefetchCount "quality of service" settings for this channel.- Parameters:
prefetchCount- maximum number of messages that the server will deliver, 0 if unlimited- Returns:
-
basicQos
Request a specific prefetchCount "quality of service" settings for this channel.- Parameters:
prefetchCount- maximum number of messages that the server will deliver, 0 if unlimitedglobal- true if the settings should be applied to the entire channel rather than each consumer- Returns:
-
rxBasicQos
Request a specific prefetchCount "quality of service" settings for this channel.- Parameters:
prefetchCount- maximum number of messages that the server will deliver, 0 if unlimitedglobal- true if the settings should be applied to the entire channel rather than each consumer- Returns:
-
basicQos
Request specific "quality of service" settings. These settings impose limits on the amount of data the server will deliver to consumers before requiring acknowledgements. Thus they provide a means of consumer-initiated flow control.- Parameters:
prefetchSize- maximum amount of content (measured in octets) that the server will deliver, 0 if unlimitedprefetchCount- maximum number of messages that the server will deliver, 0 if unlimitedglobal- true if the settings should be applied to the entire channel rather than each consumer- Returns:
-
rxBasicQos
Request specific "quality of service" settings. These settings impose limits on the amount of data the server will deliver to consumers before requiring acknowledgements. Thus they provide a means of consumer-initiated flow control.- Parameters:
prefetchSize- maximum amount of content (measured in octets) that the server will deliver, 0 if unlimitedprefetchCount- maximum number of messages that the server will deliver, 0 if unlimitedglobal- true if the settings should be applied to the entire channel rather than each consumer- Returns:
-
exchangeDeclare
-
rxExchangeDeclare
public Completable rxExchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete) Declare an exchange.- Parameters:
exchange-type-durable-autoDelete-- Returns:
-
exchangeDeclare
public Future<Void> exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, JsonObject config) Declare an exchange with additional parameters such as dead lettering, an alternate exchange or TTL.- Parameters:
exchange-type-durable-autoDelete-config-- Returns:
-
rxExchangeDeclare
public Completable rxExchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, JsonObject config) Declare an exchange with additional parameters such as dead lettering, an alternate exchange or TTL.- Parameters:
exchange-type-durable-autoDelete-config-- Returns:
-
exchangeDelete
-
rxExchangeDelete
Delete an exchange, without regard for whether it is in use or not.- Parameters:
exchange-- Returns:
-
exchangeBind
-
rxExchangeBind
Bind an exchange to an exchange.- Parameters:
destination-source-routingKey-- Returns:
-
exchangeBind
-
rxExchangeBind
-
exchangeUnbind
-
rxExchangeUnbind
Unbind an exchange from an exchange.- Parameters:
destination-source-routingKey-- Returns:
-
exchangeUnbind
-
rxExchangeUnbind
-
queueDeclareAuto
Actively declare a server-named exclusive, autodelete, non-durable queue.- Returns:
-
rxQueueDeclareAuto
Actively declare a server-named exclusive, autodelete, non-durable queue.- Returns:
-
queueBind
-
rxQueueBind
Bind a queue to an exchange- Parameters:
queue-exchange-routingKey-- Returns:
-
queueBind
-
rxQueueBind
-
queueUnbind
-
rxQueueUnbind
Unbind a queue from an exchange- Parameters:
queue-exchange-routingKey-- Returns:
-
queueUnbind
-
rxQueueUnbind
-
messageCount
-
rxMessageCount
-
start
-
rxStart
Start the rabbitMQ client. Create the connection and the channel.- Returns:
-
stop
-
rxStop
Stop the rabbitMQ client. Close the connection and its channel.- Returns:
-
isConnected
public boolean isConnected()Check if a connection is open- Returns:
- true when the connection is open, false otherwise
-
restartConnect
-
rxRestartConnect
restart the rabbitMQ connect.- Parameters:
attempts- number of attempts- Returns:
- a future notified when the operation is done with a result of the operation
-
isOpenChannel
public boolean isOpenChannel()Check if a channel is open- Returns:
- true when the connection is open, false otherwise
-
basicPublish
public Future<Void> basicPublish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.- Parameters:
exchange-routingKey-properties-body-- Returns:
-
rxBasicPublish
public Completable rxBasicPublish(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body) Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.- Parameters:
exchange-routingKey-properties-body-- Returns:
-
basicPublishWithDeliveryTag
public Future<Void> basicPublishWithDeliveryTag(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body, Handler<Long> deliveryTagHandler) Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect. The deliveryTagHandler will be called before the message is sent, which is necessary because the confirmation may arrive asynchronously before the resultHandler is called.- Parameters:
exchange-routingKey-properties-body-deliveryTagHandler- callback to capture the deliveryTag for this message. Note that this will be called synchronously in the context of the client before the result is known.- Returns:
-
rxBasicPublishWithDeliveryTag
public Completable rxBasicPublishWithDeliveryTag(String exchange, String routingKey, com.rabbitmq.client.BasicProperties properties, Buffer body, Handler<Long> deliveryTagHandler) Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect. The deliveryTagHandler will be called before the message is sent, which is necessary because the confirmation may arrive asynchronously before the resultHandler is called.- Parameters:
exchange-routingKey-properties-body-deliveryTagHandler- callback to capture the deliveryTag for this message. Note that this will be called synchronously in the context of the client before the result is known.- Returns:
-
queueDeclare
-
rxQueueDeclare
-
queueDeclare
public Future<com.rabbitmq.client.AMQP.Queue.DeclareOk> queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, JsonObject config) Declare a queue with config options- Parameters:
queue-durable-exclusive-autoDelete-config-- Returns:
-
rxQueueDeclare
public Single<com.rabbitmq.client.AMQP.Queue.DeclareOk> rxQueueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, JsonObject config) Declare a queue with config options- Parameters:
queue-durable-exclusive-autoDelete-config-- Returns:
-
queueDelete
-
rxQueueDelete
-
queueDeleteIf
-
rxQueueDeleteIf
-
newInstance
-