[erlang-questions] Pratical solutions for selective send (was: gen_event handler question)

Davide Marquês <>
Wed May 13 23:18:29 CEST 2009


Ahoy! :)

> After reading this I'm wondering... what's the current "erlang way" of
> doing
> > selective sends?
> > 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.
>
> I don't understand what's wrong with gen_event in this case? An event
> handler is not its own process. It's just a callback module. There is
> only one process and that's the event manager. Using a catch-all
> handle_event/2 should be an extremely cheap way to disregard events
> you're not interested in. Not that I have run any benchmarks.
>

In Camille's case I agree gen_event is just fine. But I'd call that case a
"selective call"
in opposition to the "selective send" (involving two processes) that I'm
looking for. :)

On the thingy I'm working on I don't really want the server process
depending on
any callback functions. The client "filter" should be sent as data so that
the client
and server code remains completely independent.

At this point I'm trying to figure out what this "filter" might be and how
to do the matching.
It seems all the match spec ma[tch]gic is done inside ets, so I might start
looking there. :)

Cheers,
:Davide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090513/c68c62c2/attachment.html>


More information about the erlang-questions mailing list