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