Provided by: libmessage-passing-perl_0.117-1_all bug

NAME

       Message::Passing::Role::ConnectionManager - A simple manager for inputs and outputs that
       need to make network connections.

DESCRIPTION

       This role is for components which make network connections, and need to handle the
       connection not starting, timeouts, disconnects etc.

       It provides a simple abstraction for multiple other classes to be able to use the same
       connection manager, and a notifies

REQUIRED METHODS

   _build_connection
       Build and return the connection we're managing, start the connection process.

       Your connection should use the API as documented below to achieve notification of connect
       and disconnect events.

API FOR CONNECTIONS

   _set_connected (1)
       Notify clients that the connection is now ready for use.

   _set_connected (0)
       Notify clients that the connection is no longer ready for use.

       Will cause the connection to be terminated and retried.

API FOR CLIENTS

       To use a connection manager, you should register yourself like this:

           $manager->subscribe_to_connect($self);

       The manager will call "$self->connected($connection)" and "$self->disconnected()" when
       appropriate.

       If the manager is already connected when you subscribe, it will immediately call back into
       your "connected" method, if it is not already connected then this will happen at a later
       point once the connection is established.

       See Message::Passing::Role::HasAConnection for a role to help with dealing with a
       connection manager.

ATTRIBUTES

   connected
       A Boolean indicating if the connection is currently considered fully connected

   connection
       The connection object (if we are connected, or connecting currently) - can be undefined if
       we are during a reconnect timeout.

   timeout
       Connections will be timed out and aborted after this time if they haven't successfully
       connected.

       Defaults to 30s

   reconnect_after
       The number of seconds to wait before starting a reconnect after a connection has timed out
       or been aborted.

       Defaults to 2s

METHODS

   subscribe_to_connect ($subscriber)
       This is called by your Input or Output, as
       "$self->connection_manager->subscribe_to_connect($self)".

       This is done for you by Message::Passing::Role::HasAConnection usually..

       This arranges to store a weak reference to your component, allowing the connection manager
       to call the "->connect" or "->disconnect" methods for any components registered when a
       connection is established or destroyed.

       Note that if the connection manager is already connected, it will immediately call the
       "->connect" method.

SPONSORSHIP

       This module exists due to the wonderful people at Suretec Systems Ltd.
       <http://www.suretecsystems.com/> who sponsored its development for its VoIP division
       called SureVoIP <http://www.surevoip.co.uk/> for use with the SureVoIP API -
       <http://www.surevoip.co.uk/support/wiki/api_documentation>

       ==head1 AUTHOR, COPYRIGHT AND LICENSE

       See Message::Passing.

perl v5.32.1                                2021-11Message::Passing::Role::ConnectionManager(3pm)