Hello community,
here is the log from the commit of package perl-Mojo-RabbitMQ-Client for
openSUSE:Factory checked in at 2017-02-21 13:51:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojo-RabbitMQ-Client (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojo-RabbitMQ-Client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojo-RabbitMQ-Client"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Mojo-RabbitMQ-Client/perl-Mojo-RabbitMQ-Client.changes
2017-02-07 12:09:05.449885784 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Mojo-RabbitMQ-Client.new/perl-Mojo-RabbitMQ-Client.changes
2017-02-21 13:51:45.576453262 +0100
@@ -1,0 +2,13 @@
+Sun Feb 19 07:00:00 UTC 2017 - [email protected]
+
+- updated to 0.0.9
+ see /usr/share/doc/packages/perl-Mojo-RabbitMQ-Client/Changes
+
+ 0.0.9 2017-02-18T11:07:56Z
+ - Proper implementation of URI parser PR#8 & #9
+ - Support for query parameter with aliases
+ - Add max_channels attribute to force maximum number of channels active
+ - Additional developer test for quick consumer
+ - Documentation changes
+
+-------------------------------------------------------------------
Old:
----
Mojo-RabbitMQ-Client-0.0.8.tar.gz
New:
----
Mojo-RabbitMQ-Client-0.0.9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojo-RabbitMQ-Client.spec ++++++
--- /var/tmp/diff_new_pack.sycBQI/_old 2017-02-21 13:51:46.028389652 +0100
+++ /var/tmp/diff_new_pack.sycBQI/_new 2017-02-21 13:51:46.032389090 +0100
@@ -17,14 +17,14 @@
Name: perl-Mojo-RabbitMQ-Client
-Version: 0.0.8
+Version: 0.0.9
Release: 0
%define cpan_name Mojo-RabbitMQ-Client
Summary: Mojo::IOLoop based RabbitMQ client
License: Artistic-2.0
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Mojo-RabbitMQ-Client/
-Source0:
http://www.cpan.org/authors/id/S/SE/SEBAPOD/%{cpan_name}-%{version}.tar.gz
+Source0:
https://cpan.metacpan.org/authors/id/S/SE/SEBAPOD/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -67,6 +67,7 @@
%files -f %{name}.files
%defattr(-,root,root,755)
-%doc Changes examples LICENSE minil.toml README.md
+%doc Changes examples minil.toml README.md
+%license LICENSE
%changelog
++++++ Mojo-RabbitMQ-Client-0.0.8.tar.gz -> Mojo-RabbitMQ-Client-0.0.9.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/Changes
new/Mojo-RabbitMQ-Client-0.0.9/Changes
--- old/Mojo-RabbitMQ-Client-0.0.8/Changes 2017-01-30 13:13:48.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/Changes 2017-02-18 12:08:14.000000000
+0100
@@ -1,3 +1,9 @@
+0.0.9 2017-02-18T11:07:56Z
+ - Proper implementation of URI parser PR#8 & #9
+ - Support for query parameter with aliases
+ - Add max_channels attribute to force maximum number of channels active
+ - Additional developer test for quick consumer
+ - Documentation changes
0.0.8 2017-01-30T12:13:18Z
- Fix issues with UTF-8 data corruption on SSL sockets PR#7
- Drop List::MoreUtils `none` in favour of core List::Util PR#4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/MANIFEST
new/Mojo-RabbitMQ-Client-0.0.9/MANIFEST
--- old/Mojo-RabbitMQ-Client-0.0.8/MANIFEST 2017-01-30 13:13:48.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/MANIFEST 2017-02-18 12:08:14.000000000
+0100
@@ -18,9 +18,13 @@
minil.toml
share/amqp0-9-1.stripped.extended.xml
share/fixed_amqp0-8.xml
+t/base.t
t/localqueue.t
t/static.t
+t/uri.t
t/use.t
+xt/client.t
+xt/consumer.t
xt/pod.t
xt/server.t
META.yml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/META.json
new/Mojo-RabbitMQ-Client-0.0.9/META.json
--- old/Mojo-RabbitMQ-Client-0.0.8/META.json 2017-01-30 13:13:48.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/META.json 2017-02-18 12:08:14.000000000
+0100
@@ -1,7 +1,7 @@
{
"abstract" : "Mojo::IOLoop based RabbitMQ client",
"author" : [
- "-2016, Sebastian Podjasek and others"
+ "-2017, Sebastian Podjasek and others"
],
"dynamic_config" : 0,
"generated_by" : "Minilla/v3.0.6",
@@ -59,7 +59,7 @@
"provides" : {
"Mojo::RabbitMQ::Client" : {
"file" : "lib/Mojo/RabbitMQ/Client.pm",
- "version" : "v0.0.8"
+ "version" : "v0.0.9"
},
"Mojo::RabbitMQ::Client::Channel" : {
"file" : "lib/Mojo/RabbitMQ/Client/Channel.pm"
@@ -91,10 +91,11 @@
"web" : "https://github.com/inway/mojo-rabbitmq-client"
}
},
- "version" : "0.0.8",
+ "version" : "0.0.9",
"x_contributors" : [
"Vidar Tyldum <[email protected]>",
"Stephan Kulow <[email protected]>",
+ "Richard Lippmann <[email protected]>",
"Sebastian Podjasek <[email protected]>"
],
"x_serialization_backend" : "JSON::PP version 2.27300"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/META.yml
new/Mojo-RabbitMQ-Client-0.0.9/META.yml
--- old/Mojo-RabbitMQ-Client-0.0.8/META.yml 2017-01-30 13:13:48.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/META.yml 2017-02-18 12:08:14.000000000
+0100
@@ -1,7 +1,7 @@
---
abstract: 'Mojo::IOLoop based RabbitMQ client'
author:
- - '-2016, Sebastian Podjasek and others'
+ - '-2017, Sebastian Podjasek and others'
build_requires:
Test::Exception: '0.43'
Test::More: '0.98'
@@ -27,7 +27,7 @@
provides:
Mojo::RabbitMQ::Client:
file: lib/Mojo/RabbitMQ/Client.pm
- version: v0.0.8
+ version: v0.0.9
Mojo::RabbitMQ::Client::Channel:
file: lib/Mojo/RabbitMQ/Client/Channel.pm
Mojo::RabbitMQ::Client::Consumer:
@@ -50,9 +50,10 @@
bugtracker: https://github.com/inway/mojo-rabbitmq-client/issues
homepage: https://github.com/inway/mojo-rabbitmq-client
repository: git://github.com/inway/mojo-rabbitmq-client.git
-version: 0.0.8
+version: 0.0.9
x_contributors:
- 'Vidar Tyldum <[email protected]>'
- 'Stephan Kulow <[email protected]>'
+ - 'Richard Lippmann <[email protected]>'
- 'Sebastian Podjasek <[email protected]>'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/README.md
new/Mojo-RabbitMQ-Client-0.0.9/README.md
--- old/Mojo-RabbitMQ-Client-0.0.8/README.md 2017-01-30 13:13:48.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/README.md 2017-02-18 12:08:14.000000000
+0100
@@ -80,6 +80,7 @@
$consumer->channel->ack($message)->deliver;
}
);
+ $consumer->start();
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
@@ -147,15 +148,126 @@
[Mojo::RabbitMQ::Client](https://metacpan.org/pod/Mojo::RabbitMQ::Client) has
following attributes.
+## tls
+
+ my $tls = $client->tls;
+ $client = $client->tls(1)
+
+Force secure connection. Default is disabled (`0`).
+
+## user
+
+ my $user = $client->user;
+ $client = $client->user('guest')
+
+Sets username for authorization, by default it's not defined.
+
+## pass
+
+ my $pass = $client->pass;
+ $client = $client->pass('secret')
+
+Sets user password for authorization, by default it's not defined.
+
+## pass
+
+ my $pass = $client->pass;
+ $client = $client->pass('secret')
+
+Sets user password for authorization, by default it's not defined.
+
+## host
+
+ my $host = $client->host;
+ $client = $client->host('localhost')
+
+Hostname or IP address of RabbitMQ server. Defaults to `localhost`.
+
+## port
+
+ my $port = $client->port;
+ $client = $client->port(1234)
+
+Port on which RabbitMQ server listens for new connections.
+Defaults to `5672`, which is standard RabbitMQ server listen port.
+
+## vhost
+
+ my $vhost = $client->vhost;
+ $client = $client->vhost('/')
+
+RabbitMQ virtual server to user. Default is `/`.
+
+## params
+
+ my $params = $client->params;
+ $client = $client->params(Mojo::Parameters->new('verify=1'))
+
+Sets additional parameters for connection. Default is not defined.
+
+For list of supported parameters see ["SUPPORTED QUERY
PARAMETERS"](#supported-query-parameters).
+
## url
my $url = $client->url;
- $client->url('rabbitmq://...');
+ $client = $client->url('amqp://...');
+
+Sets all connection parameters in one string, according to specification from
+[https://www.rabbitmq.com/uri-spec.html](https://www.rabbitmq.com/uri-spec.html).
+
+ amqp_URI = "amqp[s]://" amqp_authority [ "/" vhost ] [ "?" query ]
+
+ amqp_authority = [ amqp_userinfo "@" ] host [ ":" port ]
+
+ amqp_userinfo = username [ ":" password ]
+
+ username = *( unreserved / pct-encoded / sub-delims )
+
+ password = *( unreserved / pct-encoded / sub-delims )
+
+ vhost = segment
## heartbeat\_timeout
my $timeout = $client->heartbeat_timeout;
- $client->heartbeat_timeout(180);
+ $client = $client->heartbeat_timeout(180);
+
+Heartbeats are use to monitor peer reachability in AMQP.
+Default value is `60` seconds, if set to `0` no heartbeats will be sent.
+
+## connect\_timeout
+
+ my $timeout = $client->connect_timeout;
+ $client = $client->connect_timeout(5);
+
+Connection timeout used by
[Mojo::IOLoop::Client](https://metacpan.org/pod/Mojo::IOLoop::Client).
+Defaults to environment variable `MOJO_CONNECT_TIMEOUT` or `10` seconds
+if nothing else is set.
+
+## max\_channels
+
+ my $max_channels = $client->max_channels;
+ $client = $client->max_channels(10);
+
+Maximum number of channels allowed to be active. Defaults to `0` which
+means no implicit limit.
+
+When you try to call `add_channel` over limit an `error` will be
+emitted on channel saying that: _Maximum number of channels reached_.
+
+# STATIC METHODS
+
+## consumer
+
+ my $client = Mojo::RabbitMQ::Client->consumer(...)
+
+Shortcut for creating
[Mojo::RabbitMQ::Client::Consumer](https://metacpan.org/pod/Mojo::RabbitMQ::Client::Consumer).
+
+## publisher
+
+ my $client = Mojo::RabbitMQ::Client->publisher(...)
+
+Shortcut for creating
[Mojo::RabbitMQ::Client::Publisher](https://metacpan.org/pod/Mojo::RabbitMQ::Client::Publisher).
# METHODS
@@ -172,6 +284,18 @@
$client->close();
+## param
+
+ my $param = $client->param('name');
+ $client = $client->param(name => 'value');
+
+## add\_channel
+
+ my $channel = Mojo::RabbitMQ::Client::Channel->new();
+ ...
+ $channel = $client->add_channel($channel);
+ $channel->open;
+
## open\_channel
my $channel = Mojo::RabbitMQ::Client::Channel->new();
@@ -182,13 +306,57 @@
my $removed = $client->delete_channel($channel->id);
+# SUPPORTED QUERY PARAMETERS
+
+There's no formal specification, nevertheless a list of common parameters
+recognized by officially supported RabbitMQ clients is maintained here:
+[https://www.rabbitmq.com/uri-query-parameters.html](https://www.rabbitmq.com/uri-query-parameters.html).
+
+Some shortcuts are also supported, you'll find them in parenthesis.
+
+Aliases are less significant, so when both are specified only primary
+value will be used.
+
+## cacertfile (_ca_)
+
+Path to Certificate Authority file for TLS.
+
+## certfile (_cert_)
+
+Path to the client certificate file for TLS.
+
+## keyfile (_key_)
+
+Path to the client certificate private key file for TLS.
+
+## fail\_if\_no\_peer\_cert (_verify_)
+
+TLS verification mode, defaults to 0x01 on the client-side if a certificate
+authority file has been provided, or 0x00 otherwise.
+
+## auth\_mechanism
+
+Currently only AMQPLAIN is supported, **so this parameter is ignored**.
+
+## heartbeat
+
+Sets requested heartbeat timeout, just like `heartbeat_timeout` attribute.
+
+## connection\_timeout (_timeout_)
+
+Sets connection timeout - see
[connection\_timeout](https://metacpan.org/pod/connection_timeout) attribute.
+
+## channel\_max
+
+Sets maximum number of channels - see
[max\_channels](https://metacpan.org/pod/max_channels) attribute.
+
# SEE ALSO
[Mojo::RabbitMQ::Client::Channel](https://metacpan.org/pod/Mojo::RabbitMQ::Client::Channel),
[Mojo::RabbitMQ::Client::Consumer](https://metacpan.org/pod/Mojo::RabbitMQ::Client::Consumer),
[Mojo::RabbitMQ::Client::Publisher](https://metacpan.org/pod/Mojo::RabbitMQ::Client::Publisher)
# COPYRIGHT AND LICENSE
-Copyright (C) 2015-2016, Sebastian Podjasek and others
+Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on [AnyEvent::RabbitMQ](https://metacpan.org/pod/AnyEvent::RabbitMQ) -
Copyright (C) 2010 Masahito Ikuta, maintained by `[email protected]`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/inc/Module/AutoInstall.pm
new/Mojo-RabbitMQ-Client-0.0.9/inc/Module/AutoInstall.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/inc/Module/AutoInstall.pm 2017-01-30
13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/inc/Module/AutoInstall.pm 2017-02-18
12:08:14.000000000 +0100
@@ -8,7 +8,7 @@
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.0.8';
+ $VERSION = '0.0.9';
}
# special map on pre-defined feature sets
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Channel.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Channel.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Channel.pm
2017-01-30 13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Channel.pm
2017-02-18 12:08:14.000000000 +0100
@@ -1154,7 +1154,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015, Sebastian Podjasek
+Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on L<AnyEvent::RabbitMQ> - Copyright (C) 2010 Masahito Ikuta, maintained
by C<< [email protected] >>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Consumer.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Consumer.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Consumer.pm
2017-01-30 13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Consumer.pm
2017-02-18 12:08:14.000000000 +0100
@@ -25,6 +25,8 @@
my $exchange_name = $query->param('exchange');
my $queue_name = $query->param('queue');
+ $self->emit('connect');
+
# Create a new channel with auto-assigned id
my $channel = Mojo::RabbitMQ::Client::Channel->new();
@@ -74,16 +76,26 @@
}
);
- $channel->on(close => sub { warn 'Channel closed' });
+ $channel->on(close => sub { warn 'Channel closed: ' .
$_[1]->method_frame->reply_text; });
$client->open_channel($channel);
}
);
+ $client->on('close' => sub { shift; $self->emit('close', @_) });
+
# Start connection
$client->connect;
}
+sub close {
+ my $self = shift;
+
+ if ($self->client) {
+ $self->client->close();
+ }
+}
+
1;
=encoding utf8
@@ -138,7 +150,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015-2016, Sebastian Podjasek and others
+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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/LocalQueue.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/LocalQueue.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/LocalQueue.pm
2017-01-30 13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/LocalQueue.pm
2017-02-18 12:08:14.000000000 +0100
@@ -84,7 +84,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015, Sebastian Podjasek
+Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on L<AnyEvent::RabbitMQ::LocalQueue> - Copyright (C) 2010 Masahito
Ikuta, maintained by C<< [email protected] >>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Method/Publish.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Method/Publish.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Method/Publish.pm
2017-01-30 13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Method/Publish.pm
2017-02-18 12:08:14.000000000 +0100
@@ -69,7 +69,7 @@
message_id => undef,
timestamp => time,
type => undef,
- user_id => $self->client->login_user,
+ user_id => $self->client->user,
app_id => undef,
cluster_id => undef,
%{ $args->{header} },
@@ -191,7 +191,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015, Sebastian Podjasek
+Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on L<AnyEvent::RabbitMQ> - Copyright (C) 2010 Masahito Ikuta, maintained
by C<< [email protected] >>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Method.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Method.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Method.pm
2017-01-30 13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Method.pm
2017-02-18 12:08:14.000000000 +0100
@@ -139,7 +139,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015, Sebastian Podjasek
+Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on L<AnyEvent::RabbitMQ> - Copyright (C) 2010 Masahito Ikuta, maintained
by C<< [email protected] >>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Publisher.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Publisher.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client/Publisher.pm
2017-01-30 13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client/Publisher.pm
2017-02-18 12:08:14.000000000 +0100
@@ -115,7 +115,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015-2016, Sebastian Podjasek and others
+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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client.pm
new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client.pm
--- old/Mojo-RabbitMQ-Client-0.0.8/lib/Mojo/RabbitMQ/Client.pm 2017-01-30
13:13:48.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/lib/Mojo/RabbitMQ/Client.pm 2017-02-18
12:08:14.000000000 +0100
@@ -4,7 +4,10 @@
use Mojo::URL;
use Mojo::Home;
use Mojo::IOLoop;
+use Mojo::Parameters;
+use Mojo::Util qw(url_unescape);
use List::Util qw(none);
+use Scalar::Util qw(blessed);
use File::Basename 'dirname';
use File::ShareDir qw(dist_file);
@@ -16,31 +19,36 @@
use Mojo::RabbitMQ::Client::LocalQueue;
use Mojo::RabbitMQ::Client::Publisher;
-our $VERSION = "0.0.8";
+our $VERSION = "0.0.9";
use constant DEBUG => $ENV{MOJO_RABBITMQ_DEBUG} // 0;
-has is_open => 0;
-has url => undef;
+has is_open => 0;
+has url => undef;
+has tls => sub { shift->_uri_handler('tls') };
+has user => sub { shift->_uri_handler('user') };
+has pass => sub { shift->_uri_handler('pass') };
+has host => sub { shift->_uri_handler('host') };
+has port => sub { shift->_uri_handler('port') };
+has vhost => sub { shift->_uri_handler('vhost') };
+has params => sub { shift->_uri_handler('params') // Mojo::Parameters->new };
has connect_timeout => sub { $ENV{MOJO_CONNECT_TIMEOUT} // 10 };
has heartbeat_timeout => 60;
has heartbeat_received => 0; # When did we receive last heartbeat
has heartbeat_sent => 0; # When did we sent last heartbeat
has ioloop => sub { Mojo::IOLoop->singleton };
has max_buffer_size => 16384;
+has max_channels => 0;
has queue => sub { Mojo::RabbitMQ::Client::LocalQueue->new };
has channels => sub { {} };
-has stream_id => undef;
-has login_user => '';
+has stream_id => undef;
sub connect {
my $self = shift;
$self->{buffer} = '';
- $self->url(Mojo::URL->new($self->url));
-
my $id;
- $id = $self->_connect($self->url, sub { $self->_connected($id, @_) });
+ $id = $self->_connect(sub { $self->_connected($id, @_) });
$self->stream_id($id);
return $id;
@@ -60,6 +68,12 @@
return Mojo::RabbitMQ::Client::Publisher->new(@params);
}
+sub param {
+ my $self = shift;
+ return undef unless defined $self->params;
+ return $self->params->param(@_);
+}
+
sub add_channel {
my $self = shift;
my $channel = shift;
@@ -70,6 +84,12 @@
error => 'Channel with id: ' . $id . ' already defined');
}
+ if ($self->max_channels > 0
+ and scalar keys %{$self->channels} >= $self->max_channels)
+ {
+ return $channel->emit(error => 'Maximum number of channels reached');
+ }
+
if (not $id) {
for my $candidate_id (1 .. (2**16 - 1)) {
next if defined $self->channels->{$candidate_id};
@@ -127,6 +147,78 @@
$self->emit(error => $err);
}
+sub _uri_handler {
+ my $self = shift;
+ my $attr = shift;
+
+ return undef unless defined $self->url;
+
+ $self->url(Mojo::URL->new($self->url))
+ unless blessed $self->url && $self->url->isa('Mojo::URL');
+
+ # Set some defaults
+ my %defaults = (
+ tls => 0,
+ user => undef,
+ pass => undef,
+ host => 'localhost',
+ port => 5672,
+ vhost => '/',
+ params => undef
+ );
+
+ # Check secure scheme in url
+ $defaults{tls} = 1
+ if $self->url->scheme
+ =~ /^(amqp|rabbitmq)s$/; # Fallback support for rabbitmq scheme name
+ $defaults{port} = 5671 if $defaults{tls};
+
+ # Get host & port
+ $defaults{host} = $self->url->host
+ if defined $self->url->host && $self->url->host ne '';
+ $defaults{port} = $self->url->port if defined $self->url->port;
+
+ # Get user & password
+ my $userinfo = $self->url->userinfo;
+ if (defined $userinfo) {
+ my ($user, $pass) = split /:/, $userinfo;
+ $defaults{user} = $user;
+ $defaults{pass} = $pass;
+ }
+
+ my $vhost = url_unescape $self->url->path;
+ $vhost =~ s|^/(.+)$|$1|;
+ $defaults{vhost} = $vhost if defined $vhost && $vhost ne '';
+
+ # Query params
+ my $params = $defaults{params} = $self->url->query;
+
+ # Handle common aliases to internal names
+ my %aliases = (
+ cacertfile => 'ca',
+ certfile => 'cert',
+ keyfile => 'key',
+ fail_if_no_peer_cert => 'verify',
+ connection_timeout => 'timeout'
+ );
+ $params->param($aliases{$_}, $params->param($_))
+ foreach grep { defined $params->param($_) } keys %aliases;
+
+ # Some query parameters are translated to attribute values
+ my %attributes = (
+ heartbeat_timeout => 'heartbeat',
+ connect_timeout => 'timeout',
+ max_channels => 'channel_max'
+ );
+ $self->$_($params->param($attributes{$_}))
+ foreach grep { defined $params->param($attributes{$_}) } keys %attributes;
+
+ # Set all
+ $self->$_($defaults{$_}) foreach keys %defaults;
+
+ return $self->$attr;
+}
+
sub _close {
my $self = shift;
$self->_loop->stream($self->stream_id)->close_gracefully;
@@ -216,22 +308,20 @@
}
sub _connect {
- my ($self, $server, $cb) = @_;
+ my ($self, $cb) = @_;
# Options
# Parse according to (https://www.rabbitmq.com/uri-spec.html)
- my $url = $self->url;
- my $query = $url->query;
my $options = {
- address => $url->host,
- port => $url->port || 5672,
+ address => $self->host,
+ port => $self->port,
timeout => $self->connect_timeout,
- tls => ($url->scheme =~ /^(amqp|rabbitmq)s$/) ? 1 : 0, # Fallback
support for rabbitmq
- tls_ca => scalar $query->param('ca'),
- tls_cert => scalar $query->param('cert'),
- tls_key => scalar $query->param('key')
+ tls => $self->tls,
+ tls_ca => scalar $self->param('ca'),
+ tls_cert => scalar $self->param('cert'),
+ tls_key => scalar $self->param('key')
};
- my $verify = $query->param('verify');
+ my $verify = $self->param('verify');
$options->{tls_verify} = hex $verify if defined $verify;
# Connect
@@ -293,9 +383,6 @@
$self->{_server_properties} = $frame->method_frame->server_properties;
- # Get user & password from $url
- my ($user, $pass) = split /:/, $self->url->userinfo;
-
$self->_write_frame(
Net::AMQP::Protocol::Connection::StartOk->new(
client_properties => {
@@ -305,12 +392,11 @@
version => __PACKAGE__->VERSION,
},
mechanism => 'AMQPLAIN',
- response => {LOGIN => $user, PASSWORD => $pass,},
+ response => {LOGIN => $self->user, PASSWORD => $self->pass},
locale => 'en_US',
),
);
- $self->login_user($user);
$self->_tune($id);
},
sub {
@@ -357,7 +443,7 @@
$self->_write_expect(
'Connection::Open' =>
- {virtual_host => $self->url->path, capabilities => '', insist => 1,},
+ {virtual_host => $self->vhost, capabilities => '', insist => 1,},
'Connection::OpenOk' => sub {
$self->is_open(1);
$self->emit('open');
@@ -460,11 +546,11 @@
}
sub DESTROY {
- my $self = shift;
- my $ioloop = $self->ioloop or return;
- my $heartbeat_tid = $self->{heartbeat_tid};
+ my $self = shift;
+ my $ioloop = $self->ioloop or return;
+ my $heartbeat_tid = $self->{heartbeat_tid};
- $ioloop->remove($heartbeat_tid) if $heartbeat_tid;
+ $ioloop->remove($heartbeat_tid) if $heartbeat_tid;
}
1;
@@ -552,6 +638,7 @@
$consumer->channel->ack($message)->deliver;
}
);
+ $consumer->start();
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
@@ -619,15 +706,126 @@
L<Mojo::RabbitMQ::Client> has following attributes.
+=head2 tls
+
+ my $tls = $client->tls;
+ $client = $client->tls(1)
+
+Force secure connection. Default is disabled (C<0>).
+
+=head2 user
+
+ my $user = $client->user;
+ $client = $client->user('guest')
+
+Sets username for authorization, by default it's not defined.
+
+=head2 pass
+
+ my $pass = $client->pass;
+ $client = $client->pass('secret')
+
+Sets user password for authorization, by default it's not defined.
+
+=head2 pass
+
+ my $pass = $client->pass;
+ $client = $client->pass('secret')
+
+Sets user password for authorization, by default it's not defined.
+
+=head2 host
+
+ my $host = $client->host;
+ $client = $client->host('localhost')
+
+Hostname or IP address of RabbitMQ server. Defaults to C<localhost>.
+
+=head2 port
+
+ my $port = $client->port;
+ $client = $client->port(1234)
+
+Port on which RabbitMQ server listens for new connections.
+Defaults to C<5672>, which is standard RabbitMQ server listen port.
+
+=head2 vhost
+
+ my $vhost = $client->vhost;
+ $client = $client->vhost('/')
+
+RabbitMQ virtual server to user. Default is C</>.
+
+=head2 params
+
+ my $params = $client->params;
+ $client = $client->params(Mojo::Parameters->new('verify=1'))
+
+Sets additional parameters for connection. Default is not defined.
+
+For list of supported parameters see L</"SUPPORTED QUERY PARAMETERS">.
+
=head2 url
my $url = $client->url;
- $client->url('rabbitmq://...');
+ $client = $client->url('amqp://...');
+
+Sets all connection parameters in one string, according to specification from
+L<https://www.rabbitmq.com/uri-spec.html>.
+
+ amqp_URI = "amqp[s]://" amqp_authority [ "/" vhost ] [ "?" query ]
+
+ amqp_authority = [ amqp_userinfo "@" ] host [ ":" port ]
+
+ amqp_userinfo = username [ ":" password ]
+
+ username = *( unreserved / pct-encoded / sub-delims )
+
+ password = *( unreserved / pct-encoded / sub-delims )
+
+ vhost = segment
=head2 heartbeat_timeout
my $timeout = $client->heartbeat_timeout;
- $client->heartbeat_timeout(180);
+ $client = $client->heartbeat_timeout(180);
+
+Heartbeats are use to monitor peer reachability in AMQP.
+Default value is C<60> seconds, if set to C<0> no heartbeats will be sent.
+
+=head2 connect_timeout
+
+ my $timeout = $client->connect_timeout;
+ $client = $client->connect_timeout(5);
+
+Connection timeout used by L<Mojo::IOLoop::Client>.
+Defaults to environment variable C<MOJO_CONNECT_TIMEOUT> or C<10> seconds
+if nothing else is set.
+
+=head2 max_channels
+
+ my $max_channels = $client->max_channels;
+ $client = $client->max_channels(10);
+
+Maximum number of channels allowed to be active. Defaults to C<0> which
+means no implicit limit.
+
+When you try to call C<add_channel> over limit an C<error> will be
+emitted on channel saying that: I<Maximum number of channels reached>.
+
+=head1 STATIC METHODS
+
+=head2 consumer
+
+ my $client = Mojo::RabbitMQ::Client->consumer(...)
+
+Shortcut for creating L<Mojo::RabbitMQ::Client::Consumer>.
+
+=head2 publisher
+
+ my $client = Mojo::RabbitMQ::Client->publisher(...)
+
+Shortcut for creating L<Mojo::RabbitMQ::Client::Publisher>.
=head1 METHODS
@@ -644,6 +842,18 @@
$client->close();
+=head2 param
+
+ my $param = $client->param('name');
+ $client = $client->param(name => 'value');
+
+=head2 add_channel
+
+ my $channel = Mojo::RabbitMQ::Client::Channel->new();
+ ...
+ $channel = $client->add_channel($channel);
+ $channel->open;
+
=head2 open_channel
my $channel = Mojo::RabbitMQ::Client::Channel->new();
@@ -654,13 +864,57 @@
my $removed = $client->delete_channel($channel->id);
+=head1 SUPPORTED QUERY PARAMETERS
+
+There's no formal specification, nevertheless a list of common parameters
+recognized by officially supported RabbitMQ clients is maintained here:
+L<https://www.rabbitmq.com/uri-query-parameters.html>.
+
+Some shortcuts are also supported, you'll find them in parenthesis.
+
+Aliases are less significant, so when both are specified only primary
+value will be used.
+
+=head2 cacertfile (I<ca>)
+
+Path to Certificate Authority file for TLS.
+
+=head2 certfile (I<cert>)
+
+Path to the client certificate file for TLS.
+
+=head2 keyfile (I<key>)
+
+Path to the client certificate private key file for TLS.
+
+=head2 fail_if_no_peer_cert (I<verify>)
+
+TLS verification mode, defaults to 0x01 on the client-side if a certificate
+authority file has been provided, or 0x00 otherwise.
+
+=head2 auth_mechanism
+
+Currently only AMQPLAIN is supported, B<so this parameter is ignored>.
+
+=head2 heartbeat
+
+Sets requested heartbeat timeout, just like C<heartbeat_timeout> attribute.
+
+=head2 connection_timeout (I<timeout>)
+
+Sets connection timeout - see L<connection_timeout> attribute.
+
+=head2 channel_max
+
+Sets maximum number of channels - see L<max_channels> attribute.
+
=head1 SEE ALSO
L<Mojo::RabbitMQ::Client::Channel>, L<Mojo::RabbitMQ::Client::Consumer>,
L<Mojo::RabbitMQ::Client::Publisher>
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2015-2016, Sebastian Podjasek and others
+Copyright (C) 2015-2017, Sebastian Podjasek and others
Based on L<AnyEvent::RabbitMQ> - Copyright (C) 2010 Masahito Ikuta, maintained
by C<< [email protected] >>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/t/base.t
new/Mojo-RabbitMQ-Client-0.0.9/t/base.t
--- old/Mojo-RabbitMQ-Client-0.0.8/t/base.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/t/base.t 2017-02-18 12:08:14.000000000
+0100
@@ -0,0 +1,89 @@
+use strict;
+use Test::More tests => 7;
+
+use_ok 'Mojo::RabbitMQ::Client';
+
+subtest 'attributes' => sub {
+ plan tests => 7;
+
+ my $c = new_ok(
+ 'Mojo::RabbitMQ::Client',
+ [
+ tls => 0,
+ user => 'guest',
+ host => 'remote',
+ port => 16526,
+ vhost => '/some/'
+ ]
+ );
+
+ is($c->user, 'guest', 'user is guest');
+ is($c->pass, undef, 'no password');
+ is($c->host, 'remote', 'host is remote');
+ is($c->port, 16526, 'port is ok');
+ is($c->vhost, '/some/', 'proper vhost name');
+ isa_ok($c->params, 'Mojo::Parameters');
+};
+
+subtest 'query param aliases' => sub {
+ plan tests => 6;
+
+ my $a = new_ok(
+ 'Mojo::RabbitMQ::Client',
+ [
+ url => 'amqp:///?cacertfile=cacert&certfile=cert&keyfile=key'
+ . '&fail_if_no_peer_cert=1&connection_timeout=100'
+ ]
+ );
+
+ is($a->param('ca'), 'cacert', 'cacertfile aliased to ca');
+ is($a->param('cert'), 'cert', 'cerfile aliased to cert');
+ is($a->param('key'), 'key', 'keyfile aliased to key');
+ is($a->param('verify'), '1', 'fail_if_no_peer_cert aliased to verify');
+ is($a->param('timeout'), '100', 'connection_timeout aliased to timeout');
+};
+
+subtest 'query param aliases less significant' => sub {
+ plan tests => 2;
+
+ my $a = new_ok('Mojo::RabbitMQ::Client',
+ [url => 'amqp:///?cacertfile=cacert&ca=ca']);
+
+ is($a->param('ca'), 'cacert', 'should take base value, not alias');
+};
+
+subtest 'attributes from query params' => sub {
+ plan tests => 5;
+
+ my $a = new_ok('Mojo::RabbitMQ::Client',
+ [url => 'amqp://?heartbeat=180&timeout=90&channel_max=1']);
+
+ is($a->host, 'localhost', 'need this to parse url!');
+ is($a->heartbeat_timeout, 180, 'heartbeat timeout set');
+ is($a->connect_timeout, 90, 'connect timeout set');
+ is($a->max_channels, 1, 'max channels set');
+};
+
+subtest 'change default port for amqps scheme' => sub {
+ plan tests => 6;
+
+ my $c = new_ok('Mojo::RabbitMQ::Client', [url => 'amqps://']);
+
+ is($c->user, undef, 'no user');
+ is($c->pass, undef, 'no password');
+ is($c->host, 'localhost', 'default host');
+ is($c->port, 5671, 'changed port');
+ is($c->vhost, '/', 'default vhost');
+};
+
+subtest 'keep specified port for amqps scheme' => sub {
+ plan tests => 6;
+
+ my $c = new_ok('Mojo::RabbitMQ::Client', [url => 'amqps://:15673']);
+
+ is($c->user, undef, 'no user');
+ is($c->pass, undef, 'no password');
+ is($c->host, 'localhost', 'default host');
+ is($c->port, 15673, 'changed port');
+ is($c->vhost, '/', 'default vhost');
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/t/uri.t
new/Mojo-RabbitMQ-Client-0.0.9/t/uri.t
--- old/Mojo-RabbitMQ-Client-0.0.8/t/uri.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/t/uri.t 2017-02-18 12:08:14.000000000
+0100
@@ -0,0 +1,53 @@
+use strict;
+use Test::More tests => 79;
+
+my @order = qw(tls user pass host port vhost param);
+my @tests = ();
+
+# Basic tests taken from https://www.rabbitmq.com/uri-spec.html
+push @tests,
+ [
+ 'amqp://user:pass@host:10000/vhost',
+ 0, "user", "pass", "host", "10000", "vhost"
+ ],
+ [
+ 'amqp://user%61:%61pass@ho%61st:10000/v%2fhost',
+ 0, "usera", "apass", "hoast", "10000", "v/host"
+ ],
+ ['amqp://', 0, undef, undef, "localhost", "5672", "/"],
+ ['amqp://:@/', 0, "", "", "localhost", "5672", "/"],
+ ['amqp://user@', 0, "user", undef, "localhost", "5672", "/"],
+ ['amqp://user:pass@', 0, "user", "pass", "localhost", "5672", "/"],
+ ['amqp://host', 0, undef, undef, "host", "5672", "/"],
+ ['amqp://:10000', 0, undef, undef, "localhost", "10000", "/"],
+ ['amqp:///vhost', 0, undef, undef, "localhost", "5672", "vhost"],
+ ['amqp://host/', 0, undef, undef, "host", "5672", "/"],
+ ['amqp://host/%2f', 0, undef, undef, "host", "5672", "/"],
+ ['amqp://host///', 0, undef, undef, "host", "5672", "//"],
+ ['amqp://[::1]', 0, undef, undef, "[::1]", "5672", "/"];
+
+use_ok 'Mojo::RabbitMQ::Client';
+
+foreach my $t (@tests) {
+ my $idx = 0;
+ my $url = shift @$t;
+
+ my $client = Mojo::RabbitMQ::Client->new(url => $url);
+
+ for my $v (@$t) {
+ my $attr = $order[$idx];
+ if (ref($v) eq 'HASH') {
+ foreach my $k (keys %$v) {
+ my $x = $v->{$k};
+ is($client->$attr($k), $x,
+ "expect $attr($k) to be " . ($x // '(undefined)') . " from $url");
+ }
+ }
+ else {
+ is($client->$attr(), $v,
+ "expect $attr to be " . ($v // '(undefined)') . " from $url");
+ }
+
+ $idx++;
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/xt/client.t
new/Mojo-RabbitMQ-Client-0.0.9/xt/client.t
--- old/Mojo-RabbitMQ-Client-0.0.8/xt/client.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/xt/client.t 2017-02-18 12:08:14.000000000
+0100
@@ -0,0 +1,9 @@
+use Test::More skip_all => "TODO";
+
+subtest 'max_channels' => sub {
+
+};
+
+subtest 'utf-8 on TLS' => sub {
+
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/xt/consumer.t
new/Mojo-RabbitMQ-Client-0.0.9/xt/consumer.t
--- old/Mojo-RabbitMQ-Client-0.0.8/xt/consumer.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/xt/consumer.t 2017-02-18
12:08:14.000000000 +0100
@@ -0,0 +1,122 @@
+use Test::More tests => 10;
+
+BEGIN { use_ok 'Mojo::RabbitMQ::Client' }
+
+sub failure {
+ my ($test, $details) = @_;
+ fail($test);
+ diag("Details: " . $details) if $details;
+ Mojo::IOLoop->stop;
+}
+
+sub handle_error {
+ my $desc = $_[0] // 'Error';
+ return sub {
+ failure($desc, $_[1]->method_frame->reply_text);
+ }
+}
+
+my $run_id = time();
+my $exchange_name = 'mrc_test_' . $run_id;
+my $queue_name = 'mrc_test_queue' . $run_id;
+
+my $url = $ENV{MOJO_RABBITMQ_URL} ||
'rabbitmq://guest:[email protected]:5672/?exchange=' . $exchange_name . '&queue='
. $queue_name;
+
+Mojo::IOLoop->timer( # Global test timeout
+ 10 => sub {
+ failure('Test timeout');
+ }
+);
+
+my $client = Mojo::RabbitMQ::Client->new(url => $url);
+$client->catch(handle_error('Connection or other server errors'));
+$client->on(
+ open => sub {
+ pass('Client connected');
+
+ my $channel = Mojo::RabbitMQ::Client::Channel->new();
+ $channel->catch(handle_error("Channel error"));
+ $channel->on(close => handle_error("Channel error"));
+ $channel->on(
+ open => sub {
+ pass('Channel opened');
+
+ my $exchange = $channel->declare_exchange(
+ exchange => $exchange_name,
+ type => 'topic',
+ auto_delete => 1,
+ );
+ $exchange->catch(handle_error('Failed to declare exchange'));
+ $exchange->on(
+ success => sub {
+ pass('Exchange declared');
+
+ my $queue = $channel->declare_queue(queue => $queue_name,
+ auto_delete => 1,);
+ $queue->catch(handle_error('Failed to declare queue'));
+ $queue->on(
+ success => sub {
+ pass('Queue declared');
+
+ my $bind = $channel->bind_queue(
+ exchange => $exchange_name,
+ queue => $queue_name,
+ routing_key => $queue_name,
+ );
+ $bind->catch(handle_error('Failed to bind queue'));
+ $bind->on(
+ success => sub {
+ pass('Queue bound');
+
+ my $publish = $channel->publish(
+ exchange => $exchange_name,
+ routing_key => $queue_name,
+ body => 'Test message'
+ );
+ $publish->on(success => sub {
+ pass('Message published');
+ start_consumer();
+ $client->close();
+ });
+ $publish->deliver();
+ }
+ );
+ $bind->deliver();
+ }
+ );
+ $queue->deliver();
+ }
+ );
+ $exchange->deliver();
+ }
+ );
+
+ $client->open_channel($channel);
+ }
+);
+$client->connect();
+
+sub start_consumer {
+ my $consumer = Mojo::RabbitMQ::Client->consumer(
+ url => $url,
+ defaults => {
+ qos => {prefetch_count => 1},
+ queue => {auto_delete => 1},
+ consumer => {no_ack => 0},
+ }
+ );
+
+ $consumer->catch(sub { failure('Consumer: Connection or other server
errors') });
+ $consumer->on(connect => sub { pass('Consumer: Connected to server') });
+ $consumer->on(
+ 'message' => sub {
+ my ($consumer, $message) = @_;
+ pass('Consumer: Got message');
+ $consumer->close();
+ }
+ );
+ $consumer->on(close => sub { pass('Consumer: Disconnected');
Mojo::IOLoop->stop });
+ $consumer->start();
+}
+
+Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojo-RabbitMQ-Client-0.0.8/xt/server.t
new/Mojo-RabbitMQ-Client-0.0.9/xt/server.t
--- old/Mojo-RabbitMQ-Client-0.0.8/xt/server.t 2017-01-30 13:13:48.000000000
+0100
+++ new/Mojo-RabbitMQ-Client-0.0.9/xt/server.t 2017-02-18 12:08:14.000000000
+0100
@@ -111,7 +111,7 @@
);
$channel->on(close =>
sub { failure('Channel closed', $_[1]->method_frame->reply_text) });
- $channel->catch(sub { failure('Channel not opened') });
+ $channel->catch(sub { failure('Channel error') });
$self->open_channel($channel);
}