Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] Support of delivery filters for MPSC mboxes? #40

Closed
eao197 opened this issue Jan 7, 2022 · 4 comments
Closed

[idea] Support of delivery filters for MPSC mboxes? #40

eao197 opened this issue Jan 7, 2022 · 4 comments
Assignees

Comments

@eao197
Copy link
Member

eao197 commented Jan 7, 2022

The current version of SObjectizer prohibits the usage of delivery filters with MPSC mboxes. The root of this ban is somewhere in the past. MPSC mboxes were created as an optimization trick to speed up message exchange in 1-to-1 scenarios. Mutable messages and the role of MPSC mboxes for mutable messages were discovered much later.

There is no big sense in support for delivery filters for standard MPSC mboxes (available via agent_t::so_direct_mbox()). But there can be some forms of custom MPSC mboxes (like unique-subscribers mboxes from upcoming so5extra-1.5), and the support for delivery filters for those custom mboxes could be crucial.

The problem is that the current version of SObjectizer doesn't provide a way to specify a delivery filter for a mutable message. Message mutability isn't supported by agent_t::so_set_delivery_filter methods.

@eao197 eao197 self-assigned this Jan 7, 2022
@eao197
Copy link
Member Author

eao197 commented Jan 7, 2022

An obvious solution is support for delivery_filters with a format:

bool filter(so_5::mutable_msg<T> msg);
// and, for symmetry
bool filter(so_5::immutable_msg<T> msg);

But the problem is that so_5::mutable_msg<T> and so_5::immutable_msg<T> are empty types.

@eao197
Copy link
Member Author

eao197 commented Jan 7, 2022

Another solution is addition of some flag to agent_t::so_set_delivery_filter:

so_set_delivery_filter(so_5::message_mutability_t::mutable_message,
  [](const my_message & msg) { return msg.m_some_value < 10; });

@eao197
Copy link
Member Author

eao197 commented Apr 5, 2022

Another solution is addition of a new method:

so_set_delivery_filter_for_mutable_msg(mbox,
  [](const my_message & msg) { return msg.m_some_value < 10; });

eao197 added a commit that referenced this issue Apr 5, 2022
@eao197
Copy link
Member Author

eao197 commented May 16, 2022

Is available now in v.5.7.4.

@eao197 eao197 closed this as completed May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant