age Mojo::RabbitMQ::Client::Publisher;
use Mojo::Base -base;
use Mojo::Promise;
use Mojo::JSON qw(encode_json);
use Scalar::Util 'weaken';
require Mojo::RabbitMQ::Client;
use constant DEBUG => $ENV{
%$headers);
if (ref($body)) {
$headers{content_type} = 'application/json';
$body = encode_json $body;
}
return $self->channel->publish_p(
exchange => $ex
.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 {