| 1 | package Net::RabbitMQ::Queue; | ||||||||||||||||||||||||||||
| 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'; | |||||||||||||||||||||||||||
| 8 | 1 | has 'name'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 12 | 0 | my $channel = shift; | |||||||||||||||||||||||||||
| 13 | 0 | my $name = shift; | |||||||||||||||||||||||||||
| 14 | 0 | my $options = {@_}; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 0 | ▶ | if ($channel->_do ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 'queue_declare', $name, { | ||||||||||||||||||||||||||||
| 18 | exchange_type => "topic", | ||||||||||||||||||||||||||||
| 19 | passive => 0, # the exchange will not get declared but an error will be thrown if it does not exist. | ||||||||||||||||||||||||||||
| 20 | durable => 1, # the exchange will survive a broker restart. | ||||||||||||||||||||||||||||
| 21 | 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. | ||||||||||||||||||||||||||||
| 22 | %$options | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | )) { | ||||||||||||||||||||||||||||
| 25 | 0 | return bless { | |||||||||||||||||||||||||||
| 26 | name => $name, | ||||||||||||||||||||||||||||
| 27 | channel => $channel | ||||||||||||||||||||||||||||
| 28 | }, $class; | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # if channel didn't open, then we died before this string | ||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub bind { | ||||||||||||||||||||||||||
|
Subroutine
bind: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 36 | 0 | my $xchange = shift; | |||||||||||||||||||||||||||
| 37 | 0 | my $routing_key = shift; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my $xchange_name = (ref ($xchange) and $xchange->can ('name')) ? $xchange->name : $xchange; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $xchange and $xchange->can("name")
MC/DC0%0/2
ref $xchange and $xchange->can("name")
ref $xchange
$xchange->can("name")
Truth table0%0/3
A and B
A= ref $xchangeB= $xchange->can("name")
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | $self->channel->_do ('queue_bind', $self->name, $xchange_name, $routing_key); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub unbind { | ||||||||||||||||||||||||||
|
Subroutine
unbind: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 46 | 0 | my $xchange = shift; | |||||||||||||||||||||||||||
| 47 | 0 | my $routing_key = shift; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my $xchange_name = (ref ($xchange) and $xchange->can ('name')) ? $xchange->name : $xchange; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $xchange and $xchange->can("name")
MC/DC0%0/2
ref $xchange and $xchange->can("name")
ref $xchange
$xchange->can("name")
Truth table0%0/3
A and B
A= ref $xchangeB= $xchange->can("name")
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | $self->channel->_do ('queue_unbind', $self->name, $xchange_name, $routing_key); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 57 | 0 | my $opts = {@_}; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | my ($success, $result) = $self->channel->_do ('get', $self->name, $opts); | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | return $result; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub consume { | ||||||||||||||||||||||||||
|
Subroutine
consume: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | 0 | my $opts = {@_}; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | my ($success, $result) = $self->channel->_do ('consume', $self->name, $opts); | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub recv { | ||||||||||||||||||||||||||
|
Subroutine
recv: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 73 | #my $opts = {@_}; | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | my ($success, $result) = $self->channel->_do ('recv'); | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | return $result; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub purge { | ||||||||||||||||||||||||||
|
Subroutine
purge: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 81 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 82 | 0 | my $no_wait = $_[0]; | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | my ($success, $result) = $self->channel->_do ('purge', $self->name, @_); | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | 1; | |||||||||||||||||||||||||||