Jason W. May > Spread-Queue > Spread::Queue::Sender

Download:
Spread-Queue-0.4.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.4   Source  

NAME ^

Spread::Queue::Sender - submit messages to Spread::Queue message queues

SYNOPSIS ^

  use Spread::Queue::Sender;

  my $sender = new Spread::Queue::Sender(QUEUE => "myqueue");

  $sender->submit({ name => "value" });
  my $response = $sender->receive;

or

  my $response = $sender->rpc({ name => "value" });

DESCRIPTION ^

A Spread::Queue::Sender can submit messages for queued delivery to the first available Spread::Queue::Worker. The sqm queue manager must be running to receive and route messages.

Spread::Queue messages are Perl hashes, serialized by Data::Serializer, by default using Data::Denter.

Spread::Queue does not enforce structure on message contents.

METHODS ^

new
  my $serlzr = new Data::Serialization(serializer => "YAML");
  my $sender = new Spread::Queue::Sender(QUEUE => "myqueue",
                                         SERIALIZER => $serlzr);

Establish Spread session for transmitting messages to a queue of workers. The SERIALIZER parameter is optional, by default using Data::Denter.

submit
  $sender->submit($data);

$data should be a hashref, which will be serialized and published as a Spread message.

receive
  my $response = $sender->receive($timeout);

Wait for an incoming message on the sender's private Spread address. This is just a pass-through to Spread::Session::receive.

rpc
  my $response = $sender->rpc($data [, $timeout]);

RPC-style invocation of a remote operation. Waits $timeout seconds for a response (returns undef if no response arrives).

admin
  $sender->status;

Transmit an administrative status request to the queue manager.

syntax highlighting: