AnyEvent-RabbitMQ-RPC

 view release on metacpan or  search on metacpan

lib/AnyEvent/RabbitMQ/RPC.pm  view on Meta::CPAN


=item on_reply

Called when the job has been completed successfully, and will be passed
the return value of the job.  Returning non-string values requires that
both worker and client have been created with the same (non-empty) value
of C<serialize> passed to L</new>.

=item on_sent

Called once the job has been submitted, with a true value if the job was
submitted successfully.  A false value will be passed if the requisite
channels could not be configured, and the job was not submitted
sucessfully.

=item on_failure

Called if there was an error submitting the job, and is passed the
reason for the failure.  If C<on_sent> was also provided, this is
I<also> called after C<on_sent> is called with a false value.

=back


If no value for C<on_reply> is provided, and the C<call> function is not
in void context, a C<AnyEvent::CondVar> is used to automatically block
until a reply is received from a worker; the return value of the reply
is then returned from L</call>.


=head2 connection

Returns the L<AnyEvent::RabbitMQ> connection used by this object.

=head2 channel

Returns the L<AnyEvent::RabbitMQ::Channel> used by this object.

=head2 rpc_queue queue => C<NAME>, on_success => C<CALLBACK>

Creates the queue with the given name, used to schedule jobs.  These
queues are durable, and thus persist across program invocations and
RabbitMQ restarts.

The C<on_success> callback is called once the queue is known to exist.
The C<on_failure> may alternately be called with a reason if the queue
creation fails.

=head2 reply_queue on_success => C<CALLBACK>

Creates a temporary queue used to reply to job requests.  These queues
are anonymous and ephemeral, and are torn down after each RPC call.

The C<on_success> callback is called with the name of the queue that has
been created.  The C<on_failure> may alternately be called with a reason
if the queue creation fails.


=head1 AUTHOR

Alex Vandiver C<< <alexmv@bestpractical.com> >>

=head1 BUGS

All bugs should be reported via
L<http://rt.cpan.org/Public/Dist/Display.html?Name=AnyEvent-RabbitMQ-RPC>
or L<bug-AnyEvent-RabbitMQ-RPC@rt.cpan.org>.


=head1 LICENSE AND COPYRIGHT

This software is Copyright (c) 2012 by Best Practical Solutions

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991

=cut



( run in 3.234 seconds using v1.01-cache-2.11-cpan-d8267643d1d )