NAME
AnyEvent::Handle::ZeroMQ::Router - use AnyEvent::Handle::ZeroMQ as concurrent reply-request pattern
SYNOPSIS
use AnyEvent::Handle::ZeroMQ::Router;
use AE;
use ZeroMQ;
my $ctx = ZeroMQ::Context->new;
my $socket = $ctx->socket(ZMQ_XREP);
$socket->bind('tcp://0:8888');
my $hdl = AnyEvent::Handle::ZeroMQ::Router->new(
socket => $socket,
on_drain => sub { print "the write queue is empty\n" },
);
# or $hdl->on_drain( sub { ... } );
$hdl->push_read( sub {
my($hdl, $request, $cb) = @_;
my @reply = ...
$cb->(\@reply);
} );
AE::cv->recv;
METHODS
new( socket => ..., on_drain => ... )
get an AnyEvent::Handle::ZeroMQ::Dealer instance
push_read( cb(hdl, request_data(array_ref), reply_cb( reply_data(array_ref) ) ) )
push_write
Don't use this.