[erlang-questions] Pratical solutions for selective send (was: gen_event handler question)
Wed May 13 16:59:36 CEST 2009
On Wed, Apr 29, 2009 at 9:33 AM, Camille Troillard <tuscland@REDACTED>wrote:
> On Wed, Apr 29, 2009 at 10:17 AM, Robert Raschke <rtrlists@REDACTED>wrote:
>> > I would like to know if it is possible to write an event handler that
>> > receive only certain notifications based on a simple criteria.
>> You could use a catch all like handle_event(_, State)-> at the end of
>> your handlers? Not sure if that's the recommended way though.
> Yes, I thought about this, hehe.
> But then all the handlers would receive notifications and should decide
> themselves wether or not they should process the message, which is not good.
> It looks like a design issue on my side, oh well … maybe this is not the
> "erlang" way to do it …
After reading this I'm wondering... what's the current "erlang way" of doing
Where by "selective send" I mean:
- a client process sends a "message filter" to a server process;
- when an event occurs the server checks the client's "message filter" to
determine if a notification should be sent.
Looking for possible implementations for the "message filter" I found these:
- match_specs (http://erlang.org/doc/apps/erts/match_spec.html)
- abstract patterns (http://www.erlang.org/eeps/eep-0029.html)
>From what I read the later seems more flexible in that it enables matching
(which comes in handy since I'm interested in a "message-based + named
Are there any solutions in the wild I can take a peek at? :)
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions