AMQP/Role/BindsAQueue.pm

filter: Statementstmt 77.2% 17 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 58.3% 21 / 36 CC 3 SCAR 15.6
CC
3
Cov
63%
__ANON__
12.0
__ANON__
2.0
BEGIN
1.0
CRAP 4.8
« Output/AMQP.pm ↑ Summary AMQP/Role/DeclaresQueue.pm »
1 package Message::Passing::AMQP::Role::BindsAQueue;
2 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Types::Standard qw( Str HashRef );
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Scalar::Util qw/ weaken /;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 with qw/
8 Message::Passing::AMQP::Role::DeclaresExchange
9 Message::Passing::AMQP::Role::DeclaresQueue
10 /;
11  
12 1 has bind_routing_key => (
13 isa => Str,
14 is => 'ro',
15 default => '#',
16 );
17  
18 1 has bind_arguments => (
19 isa => HashRef,
20 is => 'ro',
21 );
22  
23 0 ▶after [qw[_set_queue ]] => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
24 0 my $self = shift;
25 0 ▶ if ($self->_has_exchange && $self->_has_queue) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_has_exchange and $self->_has_queue) 0 0 0
Condition0%0/3
$self->_has_exchange and $self->_has_queue
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_has_exchange and $self->_has_queue
$self->_has_exchange $self->_has_queue
Truth table0%0/3
A and B
A= $self->_has_exchangeB= $self->_has_queue
ABresult
0X0
100
111
26 0 weaken($self);
27 $self->_channel->bind_queue(
28 queue => $self->queue_name,
29 exchange => $self->exchange_name,
30 routing_key => $self->bind_routing_key,
31 arguments => $self->bind_arguments,
32 0 ▶ on_success => sub {
Subroutine __ANON__: not called CC=1 SCAR=0.0
33 #warn("Bound queue");
34 },
35 0 ▶ on_failure => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 0 warn("Failed to bind queue");
37 },
38 0 );
39 }
40 1 };
41  
42 1 1;
43  
44 =head1 NAME
45  
46 Message::Passing::AMQP::Role::BindsAQueue
47  
48 =head1 DESCRIPTION
49  
50 Role for components which cause a single queue to be bound to a single exchange with a single routing key.
51  
52 =head1 ATTRIBUTES
53  
54 =head2 bind_arguments
55  
56 Gets passed to L<Message::Passing::AMQP::ConnectionManager>, defaults to false.
57  
58 =head2 bind_routing_key
59  
60 Defaults to C<#>, which matches any routing key.
61  
62 =head1 CONSUMES
63  
64 =over
65  
66 =item L<Message::Passing::AMQP::Role::BindsQueues>
67  
68 =item L<Message::Passing::AMQP::Role::DeclaresExchange>
69  
70 =item L<Message::Passing::AMQP::Role::DeclaresQueue>
71  
72 =back
73  
74 =cut
« Output/AMQP.pm ↑ Summary AMQP/Role/DeclaresQueue.pm »