line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Message::Passing::Output::Redis; |
2
|
1
|
|
|
1
|
|
8542
|
use Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
787
|
use MooX::Types::MooseLike::Base qw/ Str /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
4
|
1
|
|
|
1
|
|
6
|
use namespace::clean -except => 'meta'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw/ |
7
|
|
|
|
|
|
|
Message::Passing::Redis::Role::HasAConnection |
8
|
|
|
|
|
|
|
Message::Passing::Role::Output |
9
|
|
|
|
|
|
|
/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has topic => ( |
12
|
|
|
|
|
|
|
isa => Str, |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub consume { |
18
|
0
|
|
|
0
|
|
|
my $self = shift; |
19
|
0
|
|
|
|
|
|
my $data = shift; |
20
|
0
|
|
|
|
|
|
my $headers = undef; |
21
|
0
|
|
|
|
|
|
$self->connection_manager->connection->publish($self->topic, $data); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
|
|
sub connected {} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Message::Passing::Output::Redis - A Redis publisher for Message::Passing |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$ message-pass --input STDIN --output Redis --output_options '{"topic":"foo","hostname":"127.0.0.1","port":"6379"}' |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
A simple message output which publishes messages to a Redis PubSub topic. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 hostname |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The hostname of the Redis server. Required. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 port |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The port number of the Redis server. Defaults to 6379. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 topic |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The topic to publish messages to. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 consume |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Publishes a message to Redis if connected. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 connected |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Called by L when connected. |
63
|
|
|
|
|
|
|
Does nothing in this class. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SEE ALSO |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item L |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item L |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT AND LICENSE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
See L. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|