/usr/share/perl5/Message/Passing/Output/ZeroMQ.pm is in libmessage-passing-zeromq-perl 0.007-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | package Message::Passing::Output::ZeroMQ;
use Moo;
use ZeroMQ ':all';
use namespace::clean -except => 'meta';
with qw/
Message::Passing::ZeroMQ::Role::HasASocket
Message::Passing::Role::Output
/;
has '+_socket' => (
handles => {
'_zmq_send' => 'send',
},
);
sub _socket_type { 'PUB' }
sub _build_socket_hwm { 10000 }
sub _build_socket_swap { 1024*1024*1024 }
sub consume {
my $self = shift;
my $data = shift;
$self->_zmq_send($data);
}
1;
=head1 NAME
Message::Passing::Output::ZeroMQ - output messages to ZeroMQ.
=head1 SYNOPSIS
use Message::Passing::Output::ZeroMQ;
my $logger = Message::Passing::Output::ZeroMQ->new;
$logger->consume({data => { some => 'data'}, '@metadata' => 'value' });
# Or see Log::Dispatch::Message::Passing for a more 'normal' interface to
# simple logging.
# Or use directly on command line:
message-passing --input STDIN --output ZeroMQ --output_options \
'{"connect":"tcp://192.168.0.1:5552"}'
{"data":{"some":"data"},"@metadata":"value"}
=head1 DESCRIPTION
A L<Message::Passing> ZeroMQ output class.
Can be used as part of a chain of classes with the L<message-passing> utility, or directly as
a logger in normal perl applications.
=head1 ATTRIBUTES
See L<Message::Passing::ZeroMQ/CONNECTION ATTRIBUTES>.
=head1 METHODS
=head2 consume ($msg)
Sends a message, as-is. This means that you must have encoded the message to a string before
sending it. The C<message-pass> utility will do this for you into JSON, or you can
do it manually as shown in the example in L<Message::Passing::ZeroMQ>.
=head1 SEE ALSO
=over
=item L<Message::Passing::ZeroMQ>
=item L<Message::Passing::Input::ZeroMQ>
=item L<Message::Passing>
=item L<ZeroMQ>
=item L<http://www.zeromq.org/>
=back
=head1 SPONSORSHIP
This module exists due to the wonderful people at Suretec Systems Ltd.
<http://www.suretecsystems.com/> who sponsored its development for its
VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with
the SureVoIP API -
<http://www.surevoip.co.uk/support/wiki/api_documentation>
=head1 AUTHOR, COPYRIGHT AND LICENSE
See L<Message::Passing>.
=cut
|