NAME

POEx::ZMQ3::Role::Endpoints - Add and track ZMQ targets and endpoints

SYNOPSIS

## Bind some endpoints:
package MyZMQServer;
use Moo;

# Automatically consumes POEx::ZMQ3::Role::Sockets as well:
with 'POEx::ZMQ3::Role::Endpoints';

sub start {
  my ($self, @endpoints) = @_;
  $self->_start_emitter;
  $self->create_zmq_socket( $alias, ZMQ_PUB );

  ## Bind some endpoints:
  for my $endpoint (@endpoints) {
    $self->add_endpoint( $alias, $endpoint )
  }
}

## Connect some targets:
package MyZMQClient;
. . .
sub start {
  . . .
  ## Connect some targets:
  for my $target (@targets) {
    $self->add_target_endpoint( $alias, $target )
  }
}

DESCRIPTION

A Moo::Role that adds ZeroMQ endpoint management methods to POEx::ZMQ3::Role::Sockets.

add_endpoint

$self->add_endpoint( $alias, $endpoint );

Adds and calls zmq_bind for a specified endpoint.

list_endpoints

my @endpoints = $self->list_endpoints;

List all currently known bound endpoints.

add_target_endpoint

$self->add_target_endpoint( $alias, $target );

Adds and calls zmq_connect for a specified target.

list_target_endpoints

my @connected = $self->list_target_endpoints;

Lists all currently known target endpoints.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>