line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::AMQP::Role::DeclaresExchange; |
2
|
1
|
|
|
1
|
|
506
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
422
|
use Types::Standard qw( Bool Str Enum ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
848
|
use Scalar::Util qw/ weaken /; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
69
|
|
5
|
1
|
|
|
1
|
|
7
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'Message::Passing::AMQP::Role::HasAChannel'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has exchange_name => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
isa => Str, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has exchange_type => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => Enum([qw( topic direct fanout headers )]), |
18
|
|
|
|
|
|
|
default => 'topic', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has exchange_durable => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
isa => Bool, |
24
|
|
|
|
|
|
|
default => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has exchange_auto_delete => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
isa => Bool, |
30
|
|
|
|
|
|
|
default => 0, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has _exchange => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
writer => '_set_exchange', |
36
|
|
|
|
|
|
|
predicate => '_has_exchange', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
after _set_channel => sub { |
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
weaken($self); |
42
|
|
|
|
|
|
|
$self->_channel->declare_exchange( |
43
|
|
|
|
|
|
|
type => $self->exchange_type, |
44
|
|
|
|
|
|
|
durable => $self->exchange_durable, |
45
|
|
|
|
|
|
|
auto_delete => $self->exchange_auto_delete, |
46
|
|
|
|
|
|
|
exchange => $self->exchange_name, |
47
|
|
|
|
|
|
|
on_success => sub { |
48
|
|
|
|
|
|
|
$self->_set_exchange(shift()->method_frame); |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
on_failure => sub { |
51
|
|
|
|
|
|
|
$self->_clear_channel; |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Message::Passing::AMQP::Role::DeclaresExchange - Role for instances which have an AMQP exchange. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 exchange_name |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Defines the exchange name, required. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 exchange_type |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Is one of topic, direct, fanout or headers, defaults to topic. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 exchange_durable |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Defines if the exchange is durable, defaults to true. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 exchange_auto_delete |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Defines if the exchange will be auto-deleted after the connection is closed, |
79
|
|
|
|
|
|
|
defaults to false. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
See L<Message::Passing::AMQP>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |