[Spread-users] New Perl module available: Spread::Session
Jason W. May
jmay at pobox.com
Sun Feb 10 15:57:48 EST 2002
> From: guido at pcp742651pcs.reston01.va.comcast.net
> [mailto:guido at pcp742651pcs.reston01.va.comcast.net]On Behalf Of Guido van Rossum
>
> > I've just uploaded to CPAN an alpha version of a Perl module
> > providing an OO layer on top of Spread.pm.
> >
> > SYNOPSIS
> > use Spread::Session;
> >
> > my $session = new Spread::Session;
> > $session->subscribe("mygroup");
> > $session->publish("othergroup", $message);
> >
> > $session->callbacks(message => \&message_callback,
> > timeout => \&timeout_callback,
> > admin => \&admin_callback);
> > my $input = $session->receive($timeout);
> >
>
> I'm interested in your timeout callback. When is it called? What
> can one do in it?
>
If $session->receive() doesn't pick up any inbound Spread messages,
it will call the timeout callback.
Not a particularly sophisticated event model, but I wanted to use
callbacks consistently. Since many Spread applications would have
other events besides Spread messages, a better use of Spread::Session
would be to nest it inside another event-management framework, monitor
the Spread file descriptor, and only call $session->receive(0) when
there is activity.
I'm working on a message queueing system that uses Spread::Session,
then I'll try hooking this into POE or possibly some other frameworks.
Then maybe some cross-language messaging experiments, using XML or
perhaps YAML for the message format. Guido, do you have any Python
wrappers for Spread?
Cheers,
-Jason
More information about the Spread-users
mailing list