NAME

Net::Async::AMQP::RPC::Base - base class for client and server RPC handling

VERSION

version 2.000

DESCRIPTION

This is used internally by Net::Async::AMQP::RPC::Server and Net::Async::AMQP::RPC::Client, see those classes for details.

mq

Returns the Net::Async::AMQP instance.

queue_name

Returns a Future which resolves to the queue name once the queue has been declared.

routing_key

The routing key used for publishing. Defaults to the empty string.

exchange

The exchange messages should be published to (or queues bound to).

future

Helper method for instantiating a Future.

_add_to_loop

Called when this instance is added to a IO::Async::Loop. Requires both an "mq" instance and a valid "exchange" name.

connected

Returns a Future which resolves once the underlying Net::Async::AMQP connection is established.

client_queue

Sets up a queue for an RPC client.

server_queue

Sets up a queue for an RPC server.

reply

Publishes a reply to an RPC message.

Expects the following:

  • reply_to - which queue to deliver to

  • correlation_id - the ID to use for this message

  • type - message type

  • payload - message content

  • content_type - what's in the message

  • content_encoding - any encoding layers

consumer

Activates a consumer. Resolves when the consumer is running.

on_message

Called when there's a message. Receives the Net::Async::AMQP::Channel followed by some named parameters:

  • type

  • payload - scalar containing the raw binary data for this message

  • consumer_tag - which consumer tag received this message

  • delivery_tag - the delivery information for "ack" in Net::Async::AMQP::Channel

  • routing_key - routing key used for this message

  • properties - any properties for the message

  • headers - custom headers

See "consumer" in Net::Async::AMQP::Queue for more details (including the contents of properties and headers).

process_message

Abstract method for message processing. Will receive the following named parameters:

The base implementation here will raise an exception. Override this in your subclass to do something more useful.

consumer_channel

Returns a Future which resolves to the Net::Async::AMQP::Channel used for the consumer.

publisher_channel

Returns a Future which resolves to the Net::Async::AMQP::Channel used for the publisher.

active

Returns a Future which resolves when the underlying MQ connection is ready for use.

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent

AUTHOR

Tom Molesworth <TEAM@cpan.org>

LICENSE

Licensed under the same terms as Perl itself, with additional licensing terms for the MQ spec to be found in share/amqp0-9-1.extended.xml ('a worldwide, perpetual, royalty-free, nontransferable, nonexclusive license to (i) copy, display, distribute and implement the Advanced Messaging Queue Protocol ("AMQP") Specification').