|
| | CommunicationHandler (const RabbitMqConnectionConfig &config) |
| | Construct a CommunicationHandler with the given configuration.
|
| | CommunicationHandler (const CommunicationHandler &)=delete |
| | Explicitly non-copyable and non-movable: a moved-from handler would leave its messenger's transport connection in an unusable state with no way to tell from the type alone, so that state is refused at compile time rather than left implicit.
|
|
CommunicationHandler & | operator= (const CommunicationHandler &)=delete |
|
| CommunicationHandler (CommunicationHandler &&)=delete |
|
CommunicationHandler & | operator= (CommunicationHandler &&)=delete |
| template<class Message> |
| std::expected< void, Error > | send (const Message &message, const std::string &queueName) |
| | Send a message to the specified queue.
|
| template<class Message> |
| std::expected< std::optional< Message >, Error > | receive (const std::string &queueName, std::chrono::milliseconds timeout, const std::atomic< bool > &terminationFlag) |
| | Retrieve the next message of the given type from the specified queue.
|
| template<class Message> |
| std::expected< std::optional< Message >, Error > | receive (const std::string &queueName, std::chrono::milliseconds timeout=DefaultReceiveTimeout) |
| | Retrieve the next message of the given type, with no termination flag to interrupt the wait.
|
CommunicationHandler abstracts the messaging operations that move pipeline messages between QRM&CI stages.
One send and one receive cover every message type: the type is a template parameter of the operation, not part of its name, so a new pipeline message costs a messageLabel overload rather than a new pair of methods. Neither operation throws; both report failure through std::expected, as the orchestration layer in Runners.h does, so a daemon loop can log a broker failure and keep its in-flight work instead of unwinding.
Definition at line 87 of file CommunicationHandler.h.
template<class Message>
| std::expected< std::optional< Message >, Error > mqss::qrmci::CommunicationHandler::receive |
( |
const std::string & | queueName, |
|
|
std::chrono::milliseconds | timeout = DefaultReceiveTimeout ) |
|
inlinenodiscard |
Retrieve the next message of the given type, with no termination flag to interrupt the wait.
A separate overload rather than a defaulted parameter, so that a caller with no flag to offer has to say so rather than silently binding one that can never be set. Tests and short-lived tools are the intended users; a daemon should pass its own flag.
- Template Parameters
-
| Message | The message type to receive. |
- Parameters
-
| queueName | The name of the queue to consume from. |
| timeout | The maximum time to wait for a message. 0ms polls once and returns immediately if nothing is available; WaitForever is uninterruptible on this overload since there is no flag to consult, so pass one from any process that has to shut down. |
- Returns
- The next message, an empty optional if the timeout elapsed, or a MessagingFailed error describing the failure.
Definition at line 198 of file CommunicationHandler.h.