| 1 | package Net::RabbitMQ::Exchange; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Class::Easy; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | has 'connection'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | has 'channel'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | has 'exchange_type'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | has 'passive'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | has 'auto_delete'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | has 'name'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my $channel = shift; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my $options = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | if ($channel->_do ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 'exchange_declare', $name, { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | exchange_type => "topic", | ||||||||||||||||||||||||||||||||||||||||||
| 21 | passive => 0, # the exchange will not get declared but an error will be thrown if it does not exist. | ||||||||||||||||||||||||||||||||||||||||||
| 22 | durable => 1, # the exchange will survive a broker restart. | ||||||||||||||||||||||||||||||||||||||||||
| 23 | auto_delete => 0, # the exchange will get deleted as soon as there are no more queues bound to it. Exchanges to which queues have never been bound will never get auto deleted. | ||||||||||||||||||||||||||||||||||||||||||
| 24 | %$options | ||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | )) { | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return bless { | |||||||||||||||||||||||||||||||||||||||||
| 28 | channel => $channel, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | name => $name | ||||||||||||||||||||||||||||||||||||||||||
| 30 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # if channel didn't open, then we died before this string | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $options = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my ($success, $result) = $self->channel->_do ('exchange_delete', $self->name, $options); | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub publish { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
publish: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my $routing_key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $body = shift; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $props = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $opts = {}; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | foreach my $k (keys %$props) { | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if ($k eq 'exchange' or $k eq 'mandatory' or $k eq 'immediate') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$k eq "exchange" or $k eq "mandatory" or $k eq "immediate"
$k eq "exchange" or $k eq "mandatory"
MC/DC0%0/3
$k eq "exchange" or $k eq "mandatory" or $k eq "immediate"
$k eq "exchange"
$k eq "mandatory"
$k eq "immediate"
Truth table0%0/4
A or B or C
A= $k eq "exchange"B= $k eq "mandatory"C= $k eq "immediate"
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $opts->{$k} = delete $props->{$k}; | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $opts->{exchange} = $self->name; | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my ($success, $result) = $self->channel->_do ('publish', $routing_key, $body, $opts, $props); | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||