[libanyevent-rabbitmq-perl] 01/06: Imported Upstream version 1.19
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Thu Jul 23 04:17:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to branch master
in repository libanyevent-rabbitmq-perl.
commit 6fc6bf3e8c1b22c6023b2e657eb470045a24fbc0
Author: Lucas Kanashiro <kanashiro.duarte at gmail.com>
Date: Thu Jul 23 00:52:14 2015 -0300
Imported Upstream version 1.19
---
Changes | 8 ++
META.yml | 6 +-
Makefile.PL | 2 +-
inc/Module/Install.pm | 2 +-
inc/Module/Install/Base.pm | 2 +-
inc/Module/Install/Can.pm | 2 +-
inc/Module/Install/Fetch.pm | 2 +-
inc/Module/Install/Makefile.pm | 2 +-
inc/Module/Install/Metadata.pm | 2 +-
inc/Module/Install/Share.pm | 2 +-
inc/Module/Install/Win32.pm | 2 +-
inc/Module/Install/WriteAll.pm | 2 +-
lib/AnyEvent/RabbitMQ.pm | 5 +-
lib/AnyEvent/RabbitMQ/Channel.pm | 166 +++++++++++++++++++++++++++++++++++----
xt/04_anyevent.t | 49 +++++++++++-
15 files changed, 224 insertions(+), 30 deletions(-)
diff --git a/Changes b/Changes
index 5578b4e..0bd675e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,13 @@
Revision history for Perl extension AnyEvent::RabbitMQ
+1.19 Sat Mar 21 16:49:24 GMT 2015
+ - Add 'no_ack' as an optional argument to the ->consume method
+ (Dave Mueller).
+ - Fill in some missing documentation (Moritz Lenz).
+1.18 Mon Sep 29 19:36:00 PDT 2014
+ - Added the bind_exchange and unbind_exchange methods
+ for exchange-exchange bindings.
+
1.17 Fri Jul 25 14:02:00 PDT 2014
- Add support for chunking large bodies into multiple AMQP frames,
allowing the sending of large messages.
diff --git a/META.yml b/META.yml
index 46b5c55..570855a 100644
--- a/META.yml
+++ b/META.yml
@@ -11,7 +11,7 @@ configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.08'
+generated_by: 'Module::Install version 1.06'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -31,8 +31,8 @@ requires:
Net::AMQP: 0.06
Readonly: 1.03
namespace::clean: 0
- perl: 5.6.0
+ perl: 5.10.0
resources:
license: http://dev.perl.org/licenses/
repository: git://github.com/bobtfish/AnyEvent-RabbitMQ.git
-version: 1.17
+version: 1.19
diff --git a/Makefile.PL b/Makefile.PL
index c60be3f..ed155cf 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -15,7 +15,7 @@ tests 't/*.t';
author_tests 'xt';
install_share;
-perl_version '5.006';
+perl_version '5.10';
build_requires 'Test::More';
build_requires 'Test::Exception';
build_requires 'version';
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 7680c84..4ecf46b 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.08';
+ $VERSION = '1.06';
# Storage for the pseudo-singleton
$MAIN = undef;
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 3e63345..802844a 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 93f248d..22167b8 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index ecc0d53..bee0c4f 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index c0978a4..7052f36 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index e4112f8..58430f3 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Share.pm b/inc/Module/Install/Share.pm
index e4ecfe1..4e2b602 100644
--- a/inc/Module/Install/Share.pm
+++ b/inc/Module/Install/Share.pm
@@ -8,7 +8,7 @@ use ExtUtils::Manifest ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index e529382..eeaa3fe 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 2c74308..85d8018 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.08';
+ $VERSION = '1.06';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/lib/AnyEvent/RabbitMQ.pm b/lib/AnyEvent/RabbitMQ.pm
index 41d2333..13a55db 100644
--- a/lib/AnyEvent/RabbitMQ.pm
+++ b/lib/AnyEvent/RabbitMQ.pm
@@ -32,7 +32,7 @@ use AnyEvent::RabbitMQ::LocalQueue;
use namespace::clean;
-our $VERSION = '1.17';
+our $VERSION = '1.19';
use constant {
_ST_CLOSED => 0,
@@ -734,6 +734,9 @@ You can use AnyEvent::RabbitMQ to -
* Publish, consume, get, ack, recover and reject messages
* Select, commit and rollback transactions
+Most of these actions can be done through L<AnyEvent::RabbitMQ::Channel>.
+Please see the documentation there for more details.
+
AnyEvent::RabbitMQ is known to work with RabbitMQ versions 2.5.1 and versions 0-8 and 0-9-1 of the AMQP specification.
This client is the non-blocking version, for a blocking version with a similar API, see L<Net::RabbitFoot>.
diff --git a/lib/AnyEvent/RabbitMQ/Channel.pm b/lib/AnyEvent/RabbitMQ/Channel.pm
index b5bb3b2..25c8eb7 100644
--- a/lib/AnyEvent/RabbitMQ/Channel.pm
+++ b/lib/AnyEvent/RabbitMQ/Channel.pm
@@ -220,7 +220,51 @@ sub declare_exchange {
ticket => 0,
nowait => 0, # FIXME
},
- 'Exchange::DeclareOk',
+ 'Exchange::DeclareOk',
+ $cb,
+ $failure_cb,
+ $self->{id},
+ );
+
+ return $self;
+}
+
+sub bind_exchange {
+ my $self = shift;
+ my ($cb, $failure_cb, %args) = $self->_delete_cbs(@_);
+
+ return $self if !$self->_check_open($failure_cb);
+
+ $self->{connection}->_push_write_and_read(
+ 'Exchange::Bind',
+ {
+ %args, # source, destination, routing_key
+ ticket => 0,
+ nowait => 0, # FIXME
+ },
+ 'Exchange::BindOk',
+ $cb,
+ $failure_cb,
+ $self->{id},
+ );
+
+ return $self;
+}
+
+sub unbind_exchange {
+ my $self = shift;
+ my ($cb, $failure_cb, %args) = $self->_delete_cbs(@_);
+
+ return $self if !$self->_check_open($failure_cb);
+
+ $self->{connection}->_push_write_and_read(
+ 'Exchange::Unbind',
+ {
+ %args, # source, destination, routing_key
+ ticket => 0,
+ nowait => 0, # FIXME
+ },
+ 'Exchange::UnbindOk',
$cb,
$failure_cb,
$self->{id},
@@ -243,7 +287,7 @@ sub delete_exchange {
ticket => 0,
nowait => 0, # FIXME
},
- 'Exchange::DeleteOk',
+ 'Exchange::DeleteOk',
$cb,
$failure_cb,
$self->{id},
@@ -271,7 +315,7 @@ sub declare_queue {
ticket => 0,
nowait => 0, # FIXME
},
- 'Queue::DeclareOk',
+ 'Queue::DeclareOk',
$cb,
$failure_cb,
$self->{id},
@@ -291,7 +335,7 @@ sub bind_queue {
ticket => 0,
nowait => 0, # FIXME
},
- 'Queue::BindOk',
+ 'Queue::BindOk',
$cb,
$failure_cb,
$self->{id},
@@ -312,7 +356,7 @@ sub unbind_queue {
%args, # queue, exchange, routing_key
ticket => 0,
},
- 'Queue::UnbindOk',
+ 'Queue::UnbindOk',
$cb,
$failure_cb,
$self->{id},
@@ -334,7 +378,7 @@ sub purge_queue {
ticket => 0,
nowait => 0, # FIXME
},
- 'Queue::PurgeOk',
+ 'Queue::PurgeOk',
$cb,
$failure_cb,
$self->{id},
@@ -358,7 +402,7 @@ sub delete_queue {
ticket => 0,
nowait => 0, # FIXME
},
- 'Queue::DeleteOk',
+ 'Queue::DeleteOk',
$cb,
$failure_cb,
$self->{id},
@@ -497,15 +541,16 @@ sub consume {
return $self if !$self->_check_open($failure_cb);
- my $consumer_cb = delete $args{on_consume} || sub {};
- my $cancel_cb = delete $args{on_cancel} || sub {};
+ my $consumer_cb = delete $args{on_consume} || sub {};
+ my $cancel_cb = delete $args{on_cancel} || sub {};
+ my $no_ack = delete $args{no_ack} // 1;
$self->{connection}->_push_write_and_read(
'Basic::Consume',
{
consumer_tag => '',
no_local => 0,
- no_ack => 1,
+ no_ack => $no_ack,
exclusive => 0,
%args, # queue
@@ -582,7 +627,7 @@ sub get {
%args, # queue
ticket => 0,
},
- [qw(Basic::GetOk Basic::GetEmpty)],
+ [qw(Basic::GetOk Basic::GetEmpty)],
sub {
my $frame = shift;
return $cb->({empty => $frame})
@@ -630,7 +675,7 @@ sub qos {
prefetch_size => 0,
global => 0,
},
- 'Basic::QosOk',
+ 'Basic::QosOk',
$cb,
$failure_cb,
$self->{id},
@@ -971,6 +1016,11 @@ AnyEvent::RabbitMQ::Channel - Abstraction of an AMQP channel.
=head1 DESCRIPTION
+A RabbitMQ channel.
+
+A channel is a light-weight virtual connection within a TCP connection to a
+RabbitMQ broker.
+
=head1 ARGUMENTS FOR C<open_channel>
=over
@@ -1028,10 +1078,87 @@ The name of the exchange
=back
+=head2 bind_exchange
+
+Binds an exchange to another exchange, with a routing key.
+
+Arguments:
+
+=over
+
+=item source
+
+The name of the source exchange to bind
+
+=item destination
+
+The name of the destination exchange to bind
+
+=item routing_key
+
+The routing key to bind with
+
+=back
+
+=head2 unbind_exchange
+
=head2 delete_exchange
=head2 declare_queue
+Declare a queue, that is, create it if it doesn't exist yet.
+
+Arguments:
+
+=over
+
+=item queue
+
+Name of the queue to be declared. If the queue name is the empty string,
+RabbitMQ will create a unique name for the queue. This is useful for
+temporary/private reply queues.
+
+=item on_success
+
+Callback that is called when the queue was declared successfully. The argument
+to the callback is of type L<Net::AMQP::Frame::Method>. To get the name of the
+Queue (if you declared it with an empty name), you can say
+
+ on_success => sub {
+ my $method = shift;
+ my $name = $method->method_frame->queue;
+ };
+
+=item on_failure
+
+Callback that is called when the declaration of the queue has failed.
+
+=item auto_delete
+
+0 or 1, default 0
+
+=item passive
+
+0 or 1, default 0
+
+=item durable
+
+0 or 1, default 0
+
+=item exclusive
+
+0 or 1, default 0
+
+=item no_ack
+
+0 or 1, default 1
+
+=item ticket
+
+default 0
+
+=back
+
=head2 bind_queue
Binds a queue to an exchange, with a routing key.
@@ -1102,10 +1229,18 @@ Arguments:
=over
+=item queue
+
+The name of the queue to be consumed from.
+
=item on_consume
Callback called with an argument of the message which has been consumed.
+The message is a hash reference, where the value to key C<header> is an object
+of type L<Net::AMQP::Protocol::Basic::ContentHeader>, L<body> is a
+L<Net::AMQP::Frame::Body>, and C<deliver> a L<Net::AMQP::Frame::Method>.
+
=item on_cancel
Callback called if consumption is canceled. This may be at client request
@@ -1125,6 +1260,11 @@ Callback called if the subscription was successful (before the first message is
Callback called if the subscription fails for any reason.
+=item no_ack
+
+Pass through the C<no_ack> flag. Defaults to C<1>. If set to C<1>, the server
+will not expect messages to be acknowledged.
+
=back
=head2 publish
@@ -1251,5 +1391,3 @@ the server, so the on_ack callback of publish works.
See L<AnyEvent::RabbitMQ> for author(s), copyright and license.
=cut
-
-
diff --git a/xt/04_anyevent.t b/xt/04_anyevent.t
index e4dbd5f..9cc0289 100644
--- a/xt/04_anyevent.t
+++ b/xt/04_anyevent.t
@@ -102,6 +102,29 @@ $ch->declare_exchange(
$done->recv;
$done = AnyEvent->condvar;
+$ch->declare_exchange(
+ exchange => 'test_x_dest',
+ on_success => sub {
+ pass('declare destination exchange');
+ $done->send;
+ },
+ on_failure => failure_cb($done),
+);
+$done->recv;
+
+$done = AnyEvent->condvar;
+$ch->bind_exchange(
+ source => 'test_x',
+ destination => 'test_x_dest',
+ on_success => sub {
+ pass('bind exchange -> dest');
+ $done->send;
+ },
+ on_failure => failure_cb($done),
+);
+$done->recv;
+
+$done = AnyEvent->condvar;
$ch->declare_queue(
queue => 'test_q',
on_success => sub {
@@ -270,7 +293,7 @@ $ch->cancel(
on_failure => failure_cb($done),
);
$done->recv;
-
+
$done = AnyEvent->condvar;
my $recover_count = 0;
$ch->consume(
@@ -431,6 +454,18 @@ $ch->delete_queue(
$done->recv;
$done = AnyEvent->condvar;
+$ch->unbind_exchange(
+ source => 'test_x',
+ destination => 'test_x_dest',
+ on_success => sub {
+ pass('unbind exchange');
+ $done->send;
+ },
+ on_failure => failure_cb($done),
+);
+$done->recv;
+
+$done = AnyEvent->condvar;
$ch->delete_exchange(
exchange => 'test_x',
on_success => sub {
@@ -442,6 +477,17 @@ $ch->delete_exchange(
$done->recv;
$done = AnyEvent->condvar;
+$ch->delete_exchange(
+ exchange => 'test_x_dest',
+ on_success => sub {
+ pass('delete destination exchange');
+ $done->send;
+ },
+ on_failure => failure_cb($done),
+);
+$done->recv;
+
+$done = AnyEvent->condvar;
$ar->close(
on_success => sub {
pass('close2');
@@ -496,4 +542,3 @@ sub send_large_size_message {
}
done_testing;
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-rabbitmq-perl.git
More information about the Pkg-perl-cvs-commits
mailing list