| 1 | package Message::Passing::AMQP::Role::HasAChannel; | ||
| 2 | 1 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use Scalar::Util qw/ weaken /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use AnyEvent; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use AnyEvent::RabbitMQ; |
|
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 'Message::Passing::AMQP::Role::HasAConnection'; | |
| 9 | |||
| 10 | 1 | has _channel => ( | |
| 11 | is => 'ro', | ||
| 12 | writer => '_set_channel', | ||
| 13 | clearer => '_clear_channel', | ||
| 14 | ); | ||
| 15 | |||
| 16 | 0 | ▶ | sub connected { |
|
Subroutine
connected: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 17 | 0 | my ($self, $connection) = @_; | |
| 18 | 0 | weaken($self); | |
| 19 | $connection->open_channel( | ||
| 20 | 0 | ▶ | on_success => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 21 | 0 | my $channel = shift; | |
| 22 | 0 | $self->_set_channel($channel); | |
| 23 | }, | ||
| 24 | 0 | ▶ | on_failure => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 25 | 0 | $self->_clear_channel; | |
| 26 | }, | ||
| 27 | 0 | ▶ | on_close => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 28 | 0 | $self->_clear_channel; | |
| 29 | }, | ||
| 30 | 0 | ); | |
| 31 | } | ||
| 32 | 0 | ▶ | sub disconnected {} |
|
Subroutine
disconnected: not called CC=1 SCAR=0.0
Pod
documented
| |||
| 33 | |||
| 34 | 1 | 1; | |
| 35 | |||
| 36 | =head1 NAME | ||
| 37 | |||
| 38 | Message::Passing::AMQP::Role::HasAChannel - Role for instances which have an AMQP channel. | ||
| 39 | |||
| 40 | =head1 ATTRIBUTES | ||
| 41 | |||
| 42 | =head1 METHODS | ||
| 43 | |||
| 44 | =head2 connected | ||
| 45 | |||
| 46 | Called when the channel has connected | ||
| 47 | |||
| 48 | =head2 disconnected | ||
| 49 | |||
| 50 | Called when the channel disconnects. | ||
| 51 | |||
| 52 | =head1 AUTHOR, COPYRIGHT AND LICENSE | ||
| 53 | |||
| 54 | See L<Message::Passing::AMQP>. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||