NAME

ZMQ::Declare::Device::Runtime - The runtime pitch on a ZMQ::Declare Device object

SYNOPSIS

use ZMQ::Declare;
... see ZMQ::Declare and ZMQ::Declare::ZDCF ...
my $runtime = $device->make_runtime;
# or:
$device->implementation(\&main_loop);
$device->run;

sub main_loop {
  my ($runtime) = @_;
  my $in_sock = $runtime->get_socket_by_name("listener");
  my $out_sock = $runtime->get_socket_by_name("distributor");

  while (...) {...} # actual main loop
}

DESCRIPTION

This object represents a full set of run-time 0MQ objects for a 0MQ device. It contains a 0MQ threading context and 0MQ sockets that are bound or connected to their endpoints.

Try not to share this across forks, see the nforks option to the run() method of a ZMQ::Declare::Device.

While there's a constructor, the typical way to obtain a runtime device object is to call the run() or make_runtime() methods on an abstract ZMQ::Declare::Device.

INSTANCE PROPERTIES

device

Each ZMQ::Declare::Device::Runtime object holds a reference to its generating ZMQ::Declare::Device, its abstract, declare-time progenitor, so to speak.

context

The threading context for this runtime.

sockets

A hashref of socket names to ZeroMQ::Socket objects. See also: get_socket_by_name()

METHODS

new

Constructor taking named parameters. See ZMQ::Declare::Device::run() and ZMQ::Declare::Device::make_runtime() instead.

get_socket_by_name

Takes a socket name as first argument. Returns the socket of that name or throws and exception if it doesn't exist.

SEE ALSO

ZMQ::Declare, ZMQ::Declare::Device

ZeroMQ

AUTHOR

Steffen Mueller <smueller@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2011,2012 by Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.