| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Message::Passing::Input::STOMP; |
|
2
|
1
|
|
|
1
|
|
3345
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use AnyEvent; |
|
4
|
|
|
|
|
|
|
use Scalar::Util qw/ weaken /; |
|
5
|
|
|
|
|
|
|
use Message::Passing::Types qw/ ArrayOfStr /; |
|
6
|
|
|
|
|
|
|
use namespace::autoclean; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with qw/ |
|
9
|
|
|
|
|
|
|
Message::Passing::STOMP::Role::HasAConnection |
|
10
|
|
|
|
|
|
|
Message::Passing::Role::Input |
|
11
|
|
|
|
|
|
|
/; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has destination => ( |
|
14
|
|
|
|
|
|
|
is => 'ro', |
|
15
|
|
|
|
|
|
|
isa => ArrayOfStr, |
|
16
|
|
|
|
|
|
|
coerce => 1, |
|
17
|
|
|
|
|
|
|
required => 1, |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $id = 0; |
|
21
|
|
|
|
|
|
|
sub connected { |
|
22
|
|
|
|
|
|
|
my ($self, $client) = @_; |
|
23
|
|
|
|
|
|
|
weaken($self); |
|
24
|
|
|
|
|
|
|
$client->reg_cb(MESSAGE => sub { |
|
25
|
|
|
|
|
|
|
my (undef, $body, $headers) = @_; |
|
26
|
|
|
|
|
|
|
$self->output_to->consume($body); |
|
27
|
|
|
|
|
|
|
}); |
|
28
|
|
|
|
|
|
|
foreach my $destination (@{ $self->destination }) { |
|
29
|
|
|
|
|
|
|
my $subscribe_headers = { |
|
30
|
|
|
|
|
|
|
id => $id++, |
|
31
|
|
|
|
|
|
|
destination => $destination, |
|
32
|
|
|
|
|
|
|
ack => 'auto', |
|
33
|
|
|
|
|
|
|
}; |
|
34
|
|
|
|
|
|
|
$client->send_frame('SUBSCRIBE', |
|
35
|
|
|
|
|
|
|
undef, $subscribe_headers); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Message::Passing::Input::STOMP - input messages from a STOMP queue. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
message-pass --output STDOUT --input STOMP --input_options \ |
|
49
|
|
|
|
|
|
|
'{"destination":"/queue/foo","hostname":"localhost","port":"6163","username":"guest","password":"guest"}' |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
A simple STOMP subscriber for Message::Passing. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 destination |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The queue or topic name to subscribe to on the server. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This can either be a single value, or an array of values. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 hostname |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Server hostname to connect to. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 port |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Server port number to connect to (default 6163). |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 username |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The username to connect with (defaults to 'guest'). |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 password |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
The password to connect with (defaults to 'guest'). |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 METHODS |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 connected |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Called by L<Message::Passing::STOMP::ConnectionManager> to indicate a |
|
84
|
|
|
|
|
|
|
connection to the STOMP server has been made. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Causes the subscription to the topic(s) to be started |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item L<Message::Passing::STOMP> |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item L<Message::Passing::Output::STOMP> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item L<Message::Passing> |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
See L<Message::Passing::STOMP>. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
|
|
|
|
|
|
|