Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Distributed "event" broadcasting?

by jdrago_999 (Hermit)
on Apr 21, 2009 at 00:19 UTC ( #758836=perlquestion: print w/replies, xml ) Need Help??
jdrago_999 has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I want to set up distributed (as in over the network) event broadcasting.

Just basically publish/subscribe eventing. Like you get with Microsoft Message Queue.

Example "subscriber" code:

My::EventManager->observe( 'foo.on_mobble' => sub { my $event = shift; my $foo = $event->src; # Do stuff to $foo });

Example "publisher" code:

# Let anyone who cares know that $foo has just mobbled. $foo->notify( event => 'foo.on_mobble' );

I have done this a hundred times on the same machine, and I have this working with multiple machines, but currently my events are serialized to a database that is constantly queried by my "subscribers."

It would be great if I could have something like memcached that would just magically tell all the other machines that "Event XYZ has just happened."

So to make myself clear, I'm looking for a "MultiCast" eventing tool. Where do I start?

Replies are listed 'Best First'.
Re: Distributed "event" broadcasting?
by dexterbt1 (Novice) on Apr 21, 2009 at 07:38 UTC
    Sounds like you require a publish-subscribe messaging middleware solution.

    I'd recommend using the STOMP protocol for this particular requirement. Durable Subscriptions + Topics will solve the need to multicast to multiple subscribers. That is, clients (subscribers) will have connect to a broker and "listen" for messages from a topic. A producer also connects to the broker and will be able to send messages to the topic. Each subscribers will get the exact message as sent by the producer.

    You might want to look at some of the mature brokers supporting STOMP like ActiveMQ or RabbitMQ. There is one at CPAN if you prefer a perl-based one: POE::Component::MessageQueue.

    CPAN have some client libraries like: Net::Stomp as the client library, and the POE-based POE::Component::Client::Stomp

    Just remember the important aspects of maintaining like a messaging system like persistence, durable subscriptions, etc.

Re: Distributed "event" broadcasting?
by targetsmart (Curate) on Apr 21, 2009 at 06:21 UTC
    Do you need the event manager to handle network management also for you.?
    you don't want network management to be handled by a separate module and event management by a separate module?
    Will RPC/SOAP help you in this approach?.

    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
      Apologies if I'm being a bit dense on this one, but what does "network management" mean in this context?

      --
      use JAPH;
      print JAPH::asString();

        Handling communication between server and clients over the network.

        Vivek
        -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
Re: Distributed "event" broadcasting?
by perrin (Chancellor) on Apr 21, 2009 at 17:39 UTC
    What you're doing already is a lot more robust than using memcached. You could try something like this: Have one process that polls the db for new events, and then makes HTTP requests to URLs subscribed to the event type. Then you can run HTTP servers wherever you like to receive event notifications. It's a lot more work than a simple polling setup though.
Re: Distributed "event" broadcasting?
by bibliophile (Parson) on Apr 21, 2009 at 14:04 UTC
    I've not even looked at this myself, but I think the Evergreen / OpenILS folks use Jabber. And there are a ton of jabber-related modules on CPAN....

    Just my $0.02CDN

Re: Distributed "event" broadcasting?
by beadon (Initiate) on Apr 21, 2009 at 21:50 UTC
    Have you tried with STEM ? http://search.cpan.org/~uri/Stem-0.11/lib/Stem.pm It should handle exactly what you're looking for and is relatively light weight.
Re: Distributed "event" broadcasting?
by superfrink (Curate) on Apr 24, 2009 at 03:49 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://758836]
Approved by AnomalousMonk
Front-paged by targetsmart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2018-08-19 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (186 votes). Check out past polls.

    Notices?