public class Sender extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
Sender.ConfirmSendContext<OMSG extends OutboundMessage> |
static class |
Sender.SendContext<OMSG extends OutboundMessage> |
Constructor and Description |
---|
Sender() |
Sender(SenderOptions options) |
public Sender()
public Sender(SenderOptions options)
public Mono<Void> send(Publisher<OutboundMessage> messages)
public Mono<Void> send(Publisher<OutboundMessage> messages, @Nullable SendOptions options)
public Flux<OutboundMessageResult> sendWithPublishConfirms(Publisher<OutboundMessage> messages)
This method uses RabbitMQ Publisher Confirms extension to make sure outbound messages made it or not to the broker.
See sendWithPublishConfirms(Publisher, SendOptions)
to have more control over the publishing
and the confirmations with SendOptions
.
Use sendWithTypedPublishConfirms(Publisher)
to publish instances of a custom OutboundMessage
subclass and get them back in the flux of OutboundMessageResult
.
messages
- flux of outbound messagespublic Flux<OutboundMessageResult> sendWithPublishConfirms(Publisher<OutboundMessage> messages, SendOptions options)
This method uses RabbitMQ Publisher Confirms extension to make sure outbound messages made it or not to the broker.
It is also possible to know if a message has been routed to a least one queue by enabling the mandatory flag. The default is to not use this flag.
Use sendWithTypedPublishConfirms(Publisher, SendOptions)
to publish instances of a custom OutboundMessage
subclass and get them back in the flux of OutboundMessageResult
.
messages
- flux of outbound messagesoptions
- options to configure publishingSendOptions.trackReturned(boolean)
public <OMSG extends OutboundMessage> Flux<OutboundMessageResult<OMSG>> sendWithTypedPublishConfirms(Publisher<OMSG> messages)
OutboundMessage
and expect confirmations.
This method can be interesting compared to sendWithPublishConfirms(Publisher)
when
OutboundMessage
instances of a custom class need to be published and then retrieved
in the OutboundMessageResult
flux. Such a custom class can contain correlation data
useful when dealing with the confirmation. Note the CorrelableOutboundMessage
class is provided
if just an extra property is needed compared to OutboundMessage
.
This method uses RabbitMQ Publisher Confirms extension to make sure outbound messages made it or not to the broker.
See sendWithTypedPublishConfirms(Publisher, SendOptions)
to have more control over the
publishing and the confirmations with SendOptions
.
messages
- flux of outbound messages with typed correlated metadataCorrelableOutboundMessage
public <OMSG extends OutboundMessage> Flux<OutboundMessageResult<OMSG>> sendWithTypedPublishConfirms(Publisher<OMSG> messages, @Nullable SendOptions options)
OutboundMessage
and expect confirmations.
This method can be interesting compared to sendWithPublishConfirms(Publisher)
when
OutboundMessage
instances of a custom class need to be published and then retrieved
in the OutboundMessageResult
flux. Such a custom class can contain correlation data
useful when dealing with the confirmation. Note the CorrelableOutboundMessage
class is provided
if just an extra property is needed compared to OutboundMessage
.
This method uses RabbitMQ Publisher Confirms extension to make sure outbound messages made it or not to the broker.
It is also possible to know if a message has been routed to a least one queue by enabling the mandatory flag. The default is to not use this flag.
messages
- flux of outbound messages with typed correlated metadataoptions
- options to configure publishingSendOptions.trackReturned(boolean)
public RpcClient rpcClient(String exchange, String routingKey, Supplier<String> correlationIdProvider)
public Mono<AMQP.Queue.DeclareOk> declare(QueueSpecification specification)
specification
- the specification of the queueQueueSpecification
public Mono<AMQP.Queue.DeclareOk> declare(QueueSpecification specification, @Nullable ResourceManagementOptions options)
specification
- the specification of the queueoptions
- options for resource managementQueueSpecification
,
ResourceManagementOptions
public Mono<AMQP.Queue.DeclareOk> declareQueue(QueueSpecification specification)
specification
- the specification of the queueQueueSpecification
public Mono<AMQP.Queue.DeclareOk> declareQueue(QueueSpecification specification, @Nullable ResourceManagementOptions options)
specification
- the specification of the queueoptions
- options for resource managementQueueSpecification
,
ResourceManagementOptions
public Mono<AMQP.Queue.DeleteOk> delete(QueueSpecification specification)
public Mono<AMQP.Queue.DeleteOk> delete(QueueSpecification specification, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Queue.DeleteOk> delete(QueueSpecification specification, boolean ifUnused, boolean ifEmpty)
public Mono<AMQP.Queue.DeleteOk> delete(QueueSpecification specification, boolean ifUnused, boolean ifEmpty, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Queue.DeleteOk> deleteQueue(QueueSpecification specification, boolean ifUnused, boolean ifEmpty)
public Mono<AMQP.Queue.DeleteOk> deleteQueue(QueueSpecification specification, boolean ifUnused, boolean ifEmpty, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Exchange.DeclareOk> declare(ExchangeSpecification specification)
public Mono<AMQP.Exchange.DeclareOk> declare(ExchangeSpecification specification, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Exchange.DeclareOk> declareExchange(ExchangeSpecification specification)
public Mono<AMQP.Exchange.DeclareOk> declareExchange(ExchangeSpecification specification, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Exchange.DeleteOk> delete(ExchangeSpecification specification)
public Mono<AMQP.Exchange.DeleteOk> delete(ExchangeSpecification specification, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Exchange.DeleteOk> delete(ExchangeSpecification specification, boolean ifUnused)
public Mono<AMQP.Exchange.DeleteOk> delete(ExchangeSpecification specification, boolean ifUnused, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Exchange.DeleteOk> deleteExchange(ExchangeSpecification specification, boolean ifUnused)
public Mono<AMQP.Exchange.DeleteOk> deleteExchange(ExchangeSpecification specification, boolean ifUnused, @Nullable ResourceManagementOptions options)
public Mono<AMQP.Queue.UnbindOk> unbindQueue(BindingSpecification specification)
Alias of unbind(BindingSpecification)
.
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the unbinding specificationpublic Mono<AMQP.Queue.UnbindOk> unbindQueue(BindingSpecification specification, @Nullable ResourceManagementOptions options)
Alias of unbind(BindingSpecification, ResourceManagementOptions)
.
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the unbinding specificationoptions
- options to control the operation, e.g. channel to usepublic Mono<AMQP.Queue.UnbindOk> unbind(BindingSpecification specification)
Alias of unbindQueue(BindingSpecification)
.
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the unbinding specificationpublic Mono<AMQP.Queue.UnbindOk> unbind(BindingSpecification specification, @Nullable ResourceManagementOptions options)
Alias of unbindQueue(BindingSpecification, ResourceManagementOptions)
.
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the unbinding specificationoptions
- options to control the operation, e.g. channel to usepublic Mono<AMQP.Exchange.UnbindOk> unbindExchange(BindingSpecification specification)
specification
- the unbinding specificationpublic Mono<AMQP.Exchange.UnbindOk> unbindExchange(BindingSpecification specification, @Nullable ResourceManagementOptions options)
specification
- the unbinding specificationoptions
- options to control the operation, e.g. channel to usepublic Mono<AMQP.Queue.BindOk> bindQueue(BindingSpecification specification)
Alias of bind(BindingSpecification)
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the binding specificationpublic Mono<AMQP.Queue.BindOk> bindQueue(BindingSpecification specification, @Nullable ResourceManagementOptions options)
Alias of bind(BindingSpecification, ResourceManagementOptions)
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the binding specificationoptions
- options to control the operation, e.g. channel to usepublic Mono<AMQP.Queue.BindOk> bind(BindingSpecification specification)
Alias of bindQueue(BindingSpecification)
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the binding specificationpublic Mono<AMQP.Queue.BindOk> bind(BindingSpecification specification, @Nullable ResourceManagementOptions options)
Alias of bindQueue(BindingSpecification, ResourceManagementOptions)
Warning: This method relies on RPC. As AMQP 0.9.1 protocol does not use a correlation ID for requests, a lock
is being used to prevent concurrent RPCs, making this publisher potentially blocking.
specification
- the binding specificationoptions
- options to control the operation, e.g. channel to usepublic Mono<AMQP.Exchange.BindOk> bindExchange(BindingSpecification specification)
specification
- the binding specificationpublic Mono<AMQP.Exchange.BindOk> bindExchange(BindingSpecification specification, @Nullable ResourceManagementOptions options)
specification
- the binding specificationoptions
- options to control the operation, e.g. channel to usepublic void close()
close
in interface AutoCloseable