|
RMQ - RabbitMQ C++ Library
|
Mocks rmqp::Producer and/or rmqa::Producer. More...
#include <rmqtestmocks_mockproducer.h>


Public Types | |
| enum | SendStatus { SENDING , DUPLICATE , TIMEOUT , INFLIGHT_LIMIT , TRANSFORM_ERROR } |
| Possible results of rmqp::Producer::send. | |
| typedef bsl::function< void(const rmqt::Message &, const bsl::string &routingKey, const rmqt::ConfirmResponse &)> | ConfirmationCallback |
| Invoked on receipt of message confirmation. More... | |
Public Member Functions | |
| bsl::shared_ptr< rmqa::Producer > | producer () |
| rmqt::Result< rmqp::Producer > | success () |
| rmqt::Future< rmqp::Producer > | successAsync () |
| MOCK_METHOD1 (addTransformer, void(const bsl::shared_ptr< rmqp::MessageTransformer > &transformer)) | |
| MOCK_METHOD4 (send, rmqp::Producer::SendStatus(const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback, const bsls::TimeInterval &timeout)) | |
| MOCK_METHOD5 (send, rmqp::Producer::SendStatus(const rmqt::Message &message, const bsl::string &routingKey, rmqt::Mandatory::Value mandatory, const rmqp::Producer::ConfirmationCallback &confirmCallback, const bsls::TimeInterval &timeout)) | |
| MOCK_METHOD3 (trySend, rmqp::Producer::SendStatus(const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback)) | |
| MOCK_METHOD1 (waitForConfirms, rmqt::Result<>(const bsls::TimeInterval &)) | |
| MOCK_METHOD2 (updateTopology, rmqt::Result<>(const rmqt::TopologyUpdate &, const bsls::TimeInterval &)) | |
| MOCK_METHOD1 (updateTopologyAsync, rmqt::Future<>(const rmqt::TopologyUpdate &)) | |
| virtual void | addTransformer (const bsl::shared_ptr< rmqp::MessageTransformer > &transformer)=0 |
| Adds a transformation function to be run on all messages. More... | |
| virtual SendStatus | send (const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback, const bsls::TimeInterval &timeout)=0 |
Send a message with the given routingKey to the exchange targeted by the producer. More... | |
| virtual SendStatus | send (const rmqt::Message &message, const bsl::string &routingKey, rmqt::Mandatory::Value mandatoryFlag, const rmqp::Producer::ConfirmationCallback &confirmCallback, const bsls::TimeInterval &timeout)=0 |
Send a message with the given routingKey to the exchange targeted by the producer. More... | |
| virtual SendStatus | trySend (const rmqt::Message &message, const bsl::string &routingKey, const rmqp::Producer::ConfirmationCallback &confirmCallback)=0 |
Send a message with the given routingKey to the exchange targeted by the producer. More... | |
| virtual rmqt::Result | waitForConfirms (const bsls::TimeInterval &timeout)=0 |
| Wait for all outstanding publisher confirms to arrive. More... | |
| virtual rmqt::Future | updateTopologyAsync (const rmqt::TopologyUpdate &topologyUpdate)=0 |
| Updates topology. More... | |
Static Public Member Functions | |
| static rmqt::Result< rmqp::Producer > | timeout () |
| static rmqt::Result< rmqp::Producer > | error () |
| static rmqt::Future< rmqp::Producer > | timeoutAsync () |
| static rmqt::Future< rmqp::Producer > | errorAsync () |
Mocks rmqp::Producer and/or rmqa::Producer.
|
inherited |
Invoked on receipt of message confirmation.
The user-provided ConfirmationCallback is invoked once RabbitMQ broker provides a guarantee (publisher confirm) that the message is enqueued.
A ConfirmationCallback implementation should perform any commit action, such as confirming to the sender of the message that the action will be completed. For example, an application which consumes from one queue and produces to another should send the acknowledgement to the first queue once the ConfirmationCallback is invoked from the publish.
|
pure virtualinherited |
Adds a transformation function to be run on all messages.
| transformer | The transformation function |
|
pure virtualinherited |
Send a message with the given routingKey to the exchange targeted by the producer.
The behavior of this method depends on the the number of unconfirmed messages (sent but not yet confirmed by the broker). If this number is smaller than the limit configured when calling rmqa::VHost::createProducer, this method will return immediately. Otherwise it will block until the unconfirmed message count drops below the limit.
| message | The message to be sent. |
| routingKey | The routing key (e.g. topic or queue name) passed to the exchange. |
| confirmCallback | Called when the broker explicitly confirms/rejects the message. Messages are automatically retried on reconnection, in which case this method may be called some time after invoking send. |
| timeout | How long to wait for as a relative timeout. If timeout is 0, the method will wait to send message indefinitely |
Implemented in BloombergLP::rmqa::ProducerImpl, and BloombergLP::rmqa::TracingProducerImpl.
|
pure virtualinherited |
Send a message with the given routingKey to the exchange targeted by the producer.
The behavior of this method depends on the the number of unconfirmed messages (sent but not yet confirmed by the broker). If this number is smaller than the limit configured when calling rmqa::VHost::createProducer, this method will return immediately. Otherwise it will block until the unconfirmed message count drops below the limit.
| message | The message to be sent. |
| routingKey | The routing key (e.g. topic or queue name) passed to the exchange. |
| mandatory | Specify the mandatory flag: RETURN_UNROUTABLE (Recommended): Any messages not passed to a queue are returned to the sender. confirmCallback will be invoked with a RETURN status. DISCARD_UNROUTABLE (Dangerous): Any messages not passed to a queue are confirmed by the broker. This will cause silent message loss in the event bindings aren't setup as expected. |
| confirmCallback | Called when the broker explicitly confirms/rejects the message. Messages are automatically retried on reconnection, in which case this method may be called some time after invoking send. |
| timeout | How long to wait for as a relative timeout. If timeout is 0, the method will wait to send message indefinitely |
Implemented in BloombergLP::rmqa::ProducerImpl.
|
pure virtualinherited |
Send a message with the given routingKey to the exchange targeted by the producer.
The behavior of this method depends on the the number of unconfirmed messages (sent but not yet confirmed by the broker). If this number is smaller than the limit configured when calling rmqa::VHost::createProducer, this method behaves exactly as the method send. Otherwise, unlike send, this method returns immediately with a result indicating that the unconfirmed message limit has been reached.
| message | The message to be sent. |
| routingKey | The routing key (e.g. topic or queue name) passed to the exchange. |
| confirmCallback | Called when the broker explicitly confirms/rejects the message. Messages are automatically retried on reconnection, in which case this method may be called some time after invoking send. |
Implemented in BloombergLP::rmqa::ProducerImpl, and BloombergLP::rmqa::TracingProducerImpl.
|
pure virtualinherited |
Updates topology.
Implemented in BloombergLP::rmqa::ProducerImpl.
|
pure virtualinherited |
Wait for all outstanding publisher confirms to arrive.
This method allows
| timeout | How long to wait for. If timeout is 0, the method will wait for confirms indefinitely. |
Implemented in BloombergLP::rmqa::ProducerImpl.