Comments (7)
There is an underwater rock here. The information about subscriptions is stored in two places:
- Inside the subscription storage in the agent itself. This information is used during the searching of an event-handler for an incoming message.
- Inside a mbox. This information is used for selecting receivers when a message is sent into the mbox.
For example, an agent can make three subscriptions to a message of type T
from mbox M
in different states. There will be three entries about type T
in agent's subscription storage. But only one entry inside the mbox M
: this entry tells M
that there is a receiver for messages of type T
.
If we have the following message type hierarchy:
image_base
`- image_vendor_A
`- image_vendor_B
`- image_vendor_C
and some agent makes a subscription for image_vendor_A
and image_base
from mbox M
then there will be two entries in the mbox M
: one for image_vendor_A
and another for image_base
. But there won't be any entries for image_vendor_B
or image_vendor_C
.
So if someone sends an instance of image_vendor_B
to the mbox M
then this instance will be ignored because there is no entries for such type in the mbox M
.
from sobjectizer.
Hi! I resume this old issue (motivated by #24). Do you have any ideas if this can be implemented somehow in the future? I think that matching rules similar to exception handers would be aligned with C++ semantics and can simply users' understanding.
from sobjectizer.
Hi! I made several attempts to solve this problem in the past, but didn't found a solution.
So, maybe it's time to make a new attempt... :)
from sobjectizer.
Awesome! If I can be helpful, don't hesitate to let me know (maybe for some feedback on the possible interface and trade-offs)!
from sobjectizer.
A question that have never been asked earlier:
There are not only event handlers, but also delivery filters, message limits and message sinks (with transformers or something else) that are also bound to message types. Should things support inheritance too?
For example, let's assume there is an agent:
class demo_handler final : public so_5::agent_t
{
void so_define_agent() override {
so_set_delivery_filter(source_mbox, [](const image_base & msg) { ... });
so_subscribe(source_mbox)
.event([](const image_vendor_A & msg) {...})
.event([](const image_vendor_B & msg) {...})
;
}
};
Should the delivery filter for image_base
receive messages of image_vendor_A
and image_vendor_B
?
Another example:
so_5::single_sink_binding binding;
binding.bind<image_base>(source_mbox, so_5::wrap_to_msink(dest_mbox));
so_5::send<image_vendor_A>(source_mbox, ...);
so_5::send<image_vendor_B>(source_mbox, ...);
...
Should such a binding redirects image_vendor_A
and image_vendor_B
to the dest_mbox?
from sobjectizer.
And a more complex case with delivery_filters.
Let's imagine a hierarchy:
image_base
`- image_vendor_A
`- image_bgr_base
`- image_vendor_B
`- image_vendor_C
And potential so_define_agent
:
void some_handler::so_define_agent() {
so_set_delivery_filter(source_mbox, [](const image_base &) {...});
so_set_delivery_filter(source_mbox, [](const image_bgr_base &) {...});
so_subscribe(source_mbox)
.event([](const image_vendor_B &) {...})
.event([](const image_bgr_base &) {...})
.event([](const image_vendor_A &) {...})
.event([](const image_base &) {...})
;
}
I can imagine that such double (or triple, or quadruple, or ...) filtering might be necessary and should be enabled. But I afraid it would make implementation of custom mboxes much harder.
from sobjectizer.
There is another idea of how this issue can be resolved: #82
from sobjectizer.
Related Issues (20)
- A usage example for agent_t::limit_then_redirect method in API Reference HOT 1
- [Design] Your opinion on expressing agent intent HOT 2
- Deprecation of coop_t::deregister and coop_t::deregister_normally methods HOT 1
- [idea] An emergency stop of SOEnv on an exception in noexcept context HOT 1
- `so_evt_finish` not called until `so_evt_start` is running? HOT 2
- Should agent_t::so_drop_subscription* methods be marked as noexcept? HOT 1
- Should delivery filters be checked for noexcept-ness?
- bind_and_transform HOT 10
- so_5::details::make_message_instance_impl metafunction doesn't set message mutability flag properly HOT 1
- limit_then_transform for mutable messages HOT 1
- Allow `const auto &` as an argument for delivery filter in single/multi_sink_binding HOT 1
- Should there be agent_t::so_disp_binder() and agent_t::so_coop_default_disp_binder() methods? HOT 2
- [idea] Make so5extra's revocable timers the default implementation for timers in SObjectizer
- Another constructor for wrapped_env_t that waits completion of init-function HOT 1
- Use of message limits and state_t::time_limit
- Optional name for an agent? HOT 2
- New method `as_string_view` for so_5::stats::prefix_t and so_5::stats::suffix_t HOT 1
- SO_5_TYPE shouldn't be used for so_5::stats::messages::quantity
- Integrating with GUI applications HOT 1
- Add lock_shared/unlock_shared to so_5::null_mutex_t
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sobjectizer.