|
| template<class Message, class Handler> |
| bool | mqss::qrmci::receiveNext (CommunicationHandler &comms, const std::string &queueName, std::chrono::milliseconds timeout, const std::atomic< bool > &terminationFlag, Handler &&handle) |
| | Receive one message from a queue and hand it to handle.
|
| template<class Message, class Handler> |
| bool | mqss::qrmci::drainQueue (CommunicationHandler &comms, const std::string &queueName, const std::atomic< bool > &terminationFlag, Handler &&handle) |
| | Receive from a queue until it is empty or the broker fails, handing every message to handle.
|
| template<class Message> |
| void | mqss::qrmci::send (CommunicationHandler &comms, const Message &message, const std::string &queueName) |
| | Send a message, logging rather than propagating a failure.
|
| void | mqss::qrmci::sendFailure (CommunicationHandler &comms, const mqss::QuantumTask &task, const Error &failure, std::string_view stage) |
| | Tell a task's submitter that the task failed, and log why.
|
| void | mqss::qrmci::sendResult (CommunicationHandler &comms, const mqss::QuantumTask &task, const mqss::QuantumResult &result) |
| | Send a task's result to its own result destination, and log it.
|
The queue I/O every QRM&CI daemon work loop shares: receiving and draining a queue, and the best-effort sends a work loop makes, including telling a task's submitter how it ended.
Definition in file DaemonMessaging.h.
template<class Message, class Handler>
| bool mqss::qrmci::receiveNext |
( |
CommunicationHandler & | comms, |
|
|
const std::string & | queueName, |
|
|
std::chrono::milliseconds | timeout, |
|
|
const std::atomic< bool > & | terminationFlag, |
|
|
Handler && | handle ) |
Receive one message from a queue and hand it to handle.
Neither an empty queue nor a broker failure is fatal to a work loop: both simply mean there is nothing to do this turn, the second after a warning.
- Template Parameters
-
| Message | The message type to receive. |
| Handler | Callable as handle(Message &&). |
- Parameters
-
| comms | The handler to receive through. |
| queueName | The queue to consume from. |
| timeout | How long to wait; 0ms polls once and returns immediately. |
| terminationFlag | Consulted before the receive attempt (and between polls of an indefinite wait), so a shutdown interrupts the wait rather than outliving it. The caller supplies this explicitly – a daemon passes its own process-wide flag; a test or short-lived tool that never shuts down can pass one that is never set. |
| handle | Invoked with the received message, if one arrived. |
- Returns
- True if a message was received and handed to
handle.
Definition at line 46 of file DaemonMessaging.h.