NAME
AMQP::Publisher -- Publishes messages to an exchange.
SYNOPSIS
use AMQP::Publisher;
my $publisher = AMQP::Publisher->new;
$publisher->server('amqp://foo:bar@localhost:5672/testing');
$publisher->exchange('test');
$publisher->type('topic');
$publisher->queue('testing');
$publisher->on_connect( sub {
my ($self) = @_;
$self->channel->send('hello world');
});
$publisher->attach;
DESCRIPTION
The AMQP::Publisher publishes messages to an AMQP exchange
METHODS
new() (constructor)
Creates a new AMQP::Producer which can
Returns: new instance of this class.
server($url)
Configures all of the connection settings based on an AMQP url. The format of which is:
amqp://username:password@host:port/vhost
All of the elements of the url are required if you are not using the defaults. The default settings are:
amqp://guest:guest@localhost:5672/
attach()
Connects to the AMQP server specified by the server()
method. When the server connects it will invoke the publisher's on_connect()
callback. This can enable you to setup additional event loops to drive the publisher.
send()
After the Publisher object has attached to the AMQP server, it is capable of sending messages to the configured exchange and key.
exchange( $exchange )
An accessor to the configured exchange.
key( $key )
And accessor to the configured routing key.
TODO
BUGS
If you find them out
COPYRIGHT
Same as Perl.
AUTHORS
Dave Goehrig <dave@dloh.org>