Provided by: libmojo-rabbitmq-client-perl_0.1.0-1_all bug

NAME

       Mojo::RabbitMQ::Client::Publisher - simple Mojo::RabbitMQ::Client based publisher

SYNOPSIS

         use Mojo::RabbitMQ::Client::Publisher;
         my $publisher = Mojo::RabbitMQ::Client::Publisher->new(
           url => 'amqp://guest:guest@127.0.0.1:5672/?exchange=mojo&routing_key=mojo'
         );

         $publisher->publish_p(
           {encode => { to => 'json'}},
           routing_key => 'mojo_mq'
         )->then(sub {
           say "Message published";
         })->catch(sub {
           die "Publishing failed"
         })->wait;

DESCRIPTION

ATTRIBUTES

       Mojo::RabbitMQ::Client::Publisher has following attributes.

   url
       Sets all connection parameters in one string, according to specification from
       <https://www.rabbitmq.com/uri-spec.html>.

       For detailed description please see Mojo::RabbitMQ::Client#url.

METHODS

       Mojo::RabbitMQ::Client::Publisher implements only single method.

   publish_p
         $publisher->publish_p('simple plain text body');

         $publisher->publish_p({ some => 'json' });

         $publisher->publish_p($body, { header => 'content' }, routing_key => 'mojo', mandatory => 1);

       Method signature

         publish_p($body!, \%headers?, *@params)

       body
         First argument is mandatory body content of published message.  Any reference passed
         here will be encoded as JSON and accordingly "content_type" header will be set to
         "application/json".

       headers
         If second argument is a HASHREF it will be merged to message headers.

       params
         Any other arguments will be considered key/value pairs and passed to publish method as
         arguments overriding everything besides body argument.

         So this:

           $publisher->publish($body, { header => 'content' });

         can be also written like this:

           $publisher->publish($body, header => { header => 'content' });

         But beware - headers get merged, but params override values so when you write this:

           $publisher->publish({ json => 'object' }, header => { header => 'content' });

         message will lack "content_type" header!

SEE ALSO

       Mojo::RabbitMQ::Client

COPYRIGHT AND LICENSE

       Copyright (C) 2015-2017, Sebastian Podjasek and others

       This program is free software, you can redistribute it and/or modify it under the terms of
       the Artistic License version 2.0.

POD ERRORS

       Hey! The above document had some coding errors, which are explained below:

       Around line 202:
           You forgot a '=back' before '=head1'