Input/AMQP.pm

filter: Statementstmt 69.2% 18 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.4% 5 / 11 Podpod n/a totaltotal 62.1% 23 / 37 CC 1 SCAR 3.7
CC
1
Cov
69%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.5
« AMQP/Role/HasAConnection.pm ↑ Summary AMQP/Role/DeclaresExchange.pm »
1 package Message::Passing::Input::AMQP;
2 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use AnyEvent;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Scalar::Util qw/ weaken refaddr /;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 with qw/
9 Message::Passing::AMQP::Role::BindsAQueue
10 Message::Passing::Role::Input
11 /;
12  
13  
14 0 ▶after '_set_queue' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
15 0 my $self = shift;
16 0 weaken($self);
17 $self->_channel->consume(
18 0 ▶ on_consume => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 0 my $message = shift;
20 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 0 $self->output_to->consume($message->{body}->payload);
22 }
23 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 warn("Error in consume_message callback: $_");
25 0 };
26 },
27 consumer_tag => refaddr($self),
28 0 ▶ on_success => sub {
Subroutine __ANON__: not called CC=1 SCAR=0.0
29 },
30 0 ▶ on_failure => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 0 Carp::cluck("Failed to start message consumer in $self response " . Dumper(@_));
32 },
33 0 );
34 1 };
35  
36 1 1;
37  
38 =head1 NAME
39  
40 Message::Passing::Input::AMQP - input logstash messages from AMQP.
41  
42 =head1 SYNOPSIS
43  
44 message-pass --output STDOUT --input AMQP --input_options '{"queue_name":"test","exchange_name":"test","hostname":"127.0.0.1","username":"guest","password":"guest"}'
45  
46 =head1 DESCRIPTION
47  
48 =head1 SEE ALSO
49  
50 =over
51  
52 =item L<Message::Passing::AMQP>
53  
54 =item L<Message::Passing::Output::AMQP>
55  
56 =item L<Message::Passing>
57  
58 =item L<AMQP>
59  
60 =item L<http://www.zeromq.org/>
61  
62 =back
63  
64 =head1 AUTHOR, COPYRIGHT AND LICENSE
65  
66 See L<Message::Passing::AMQP>.
67  
68 =cut
69  
« AMQP/Role/HasAConnection.pm ↑ Summary AMQP/Role/DeclaresExchange.pm »