hmbdc
simplify-high-performance-messaging-programming
|
It behaves like Client, with the extra capability of storing messages received and processing them later - it is used when the user wants to process messages in a specific order other than FIFO. If a message is deemed to come too early, just stash it and move on (to the next message). The stashed messages will be delivered later at the user's choice - see the added stash and openStash functions. The stash mechanism can enforce any particular order of message processing regarless of the order of message being sent. More...
#include <ClientWithStash.hpp>
Public Member Functions | |
template<typename Iterator > | |
size_t | handleRangeImpl (Iterator it, Iterator end, uint16_t threadId) |
do not touch - internal use | |
![]() | |
char const * | hmbdcName () const |
return the name of thread that runs this client, override if necessary More... | |
std::tuple< char const *, int > | schedSpec () const |
an overrideable method. returns the schedule policy and priority, override if necessary priority is only used when policy is "SCHED_RR", or "SCHED_FIFO" More... | |
size_t | maxBatchMessageCount () const |
an overridable method. client receives events in batches and the max batch size is controllable when running in direct mode Context. Here is to specify the max size. More... | |
virtual void | messageDispatchingStartedCb (size_t const *pClientDispatchingStarted) |
called before any messages got dispatched - only once More... | |
virtual void | stoppedCb (std::exception const &e) |
callback called when this Client is taken out of message dispatching More... | |
virtual bool | droppedCb () |
callback called after the Client is safely taken out of the Context More... | |
virtual void | invokedCb (size_t dispatched) |
this callback is called all the time (frequently) - the exact timing is after a batch of messages are dispatched. After this call returns, the previously dispatched message's addresses are no longer valid, which means if you cache the event addresses in the previous handleMessageCb()s, you cannot use those after the return of the next invokeCb function. More... | |
virtual | ~Client () |
trivial | |
void | stopped (std::exception const &e) noexcept |
the following are for internal use, don't change or override | |
Protected Member Functions | |
template<MessageC Message> | |
void | stash (Message const &message) |
stash a message that will be delivered later to the same callback More... | |
void | openStash () |
release the stashed messages - after this call is returned, the callbacks of the stahsed message will be invoked with the stashed messages More... | |
![]() | |
void | batchDone () |
the derived user's Client has the option to stop the current batch of event dispatching. More... | |
It behaves like Client, with the extra capability of storing messages received and processing them later - it is used when the user wants to process messages in a specific order other than FIFO. If a message is deemed to come too early, just stash it and move on (to the next message). The stashed messages will be delivered later at the user's choice - see the added stash and openStash functions. The stash mechanism can enforce any particular order of message processing regarless of the order of message being sent.
|
inlineprotected |
release the stashed messages - after this call is returned, the callbacks of the stahsed message will be invoked with the stashed messages
it is fine to stash more / new messages even in the above callbacks invoked due to stashed messages
|
inlineprotected |
stash a message that will be delivered later to the same callback
when the Client decide a message is not ready to be handled now but is needed later, it calls this message to stash it, see also openStash()
message | the message to be stashed |