POEx::ZMQ3::Replier - A REP-type ZeroMQ socket
use POE; my $zrep = POEx::ZMQ3::Replier->new; POE::Session->create( inline_states => { _start => sub { ## Wait for requests on an endpoint: $zrep->start( 'tcp://127.0.0.1:5665' ); ## Subscribe to all emitted events: $_[KERNEL]->post( $zrep->session_id, 'subscribe', 'all', ); }, zeromq_replying_on => sub { my $endpoint = $_[ARG0]; print "Waiting for requests on $endpoint\n"; }, zeromq_got_request => sub { my $data = $_[ARG0]; ## Got a request we can reply to. $zrep->reply("pong!") }, } ); $poe_kernel->run;
A ZeroMQ REP-type socket using POEx::ZMQ3::Role::Endpoints and MooX::Role::POE::Emitter.
A REP-type socket waits for a request (see POEx::ZMQ3::Requestor) and issues a reply accordingly.
$zrep->start( $endpoint );
Start the Replier and listen on a specified endpoint.
$zrep->stop;
Stop the Replier, closing out the socket and stopping the event emitter.
$zrep->reply( $data );
Issue a reply to a request.
Should be called out of a "zeromq_got_request" handler.
Emitted when we are initialized; $_[ARG0] is the endpoint we are waiting for requests on.
Emitted when a request arrives; $_[ARG0] is the raw data.
POEx::ZMQ3
POEx::ZMQ3::Requestor
ZMQ::LibZMQ3
http://www.zeromq.org
Jon Portnoy <avenj@cobaltirc.org>
To install POEx::ZMQ3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POEx::ZMQ3
CPAN shell
perl -MCPAN -e shell install POEx::ZMQ3
For more information on module installation, please visit the detailed CPAN module installation guide.