v.5.7.4 - Stiffstream/sobjectizer GitHub Wiki
This page describes changes and new features of v.5.7.4.
It's possible to set a custom MPSC mbox as the direct mbox for an agent
Every agent receives own MPSC mbox called direct mbox. That is mbox returned by agent_t::so_direct_mbox()
method. The type of that mbox is hidden from a user, it's only known that it's MPSC mbox.
Since v.5.7.4 it's possible to set a custom MPSC mbox as the direct mbox for an agent. It means that a user can implement own MPSC mbox with custom logic and then use such an mbox as the direct mbox for an agent. For, example, such mbox can prohibit sending of some types of messages or redirects some messages to another destinations.
See the corresponding Wiki section for more details.
Delivery filters can now be used with MPSC mboxes
Until v.5.7.4 delivery filters were unsupported by MPSC mboxes. Since v.5.7.4 it's possible to set a delivery mbox for MPSC mboxes implemented by SObjectizer and so5extra companion project (so5extra supports this feature since v.1.5.1). It means that such code is expected to work now:
void my_agent::so_define_agent() {
so_set_delivery_filter(so_direct_mbox(), [](const some_message & msg) {..});
...
}
It also means that a delivery filter can be set for a mutable message, but instead of so_set_delivery_filter
a new method so_set_delivery_filter_for_mutable_msg
has to be used:
void my_agent::so_define_agent() {
so_set_delivery_filter_for_mutable_msg( so_direct_mbox(),
[]( const some_message & msg ) {...} );
...
}
NOTE. Since v.5.7.4 so_direct_mbox
can return a custom mbox. The support of delivery filters for custom MPSC mbox implementation isn't under the control of SObjectizer. So if a custom mbox is returned by so_direct_mbox
an attempt to set a delivery filter for it could fail.