AnyEvent-Stomper

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

        print "Consumed: $body\n";

        $cv->send;
      },
    );

    $cv->recv;

# DESCRIPTION

AnyEvent::Stomper is flexible non-blocking STOMP client. Supports following
STOMP versions: 1.0, 1.1, 1.2.

Is recommended to read STOMP protocol specification before using the client:
[https://stomp.github.io/index.html](https://stomp.github.io/index.html)

# CONSTRUCTOR

## new( %params )

    my $stomper = AnyEvent::Stomper->new(
      host               => 'localhost',
      port               => '61613',
      login              => 'guest',
      passcode           => 'guest',
      vhost              => '/',
      heartbeat          => [ 5000, 5000 ],
      connection_timeout => 5,
      lazy               => 1,
      reconnect_interval => 5,

      on_connect => sub {
        # handling...
      },

      on_disconnect => sub {
        # handling...
      },

      on_error => sub {
        my $err = shift;

        # error handling...
      },
    );

- host => $host

    Server hostname (default: localhost)

- port => $port

    Server port (default: 61613)

- login => $login

    The user identifier used to authenticate against a secured STOMP server.

- passcode => $passcode

    The password used to authenticate against a secured STOMP server.

- vhost => $vhost

    The name of a virtual host that the client wishes to connect to.

- heartbeat => \\@heartbeat

    Heart-beating can optionally be used to test the healthiness of the underlying
    TCP connection and to make sure that the remote end is alive and kicking. The
    first number sets interval in milliseconds between outgoing heart-beats to the
    STOMP server. `0` means, that the client will not send heart-beats. The second
    number sets interval in milliseconds between incoming heart-beats from the
    STOMP server. `0` means, that the client does not want to receive heart-beats.

        heartbeat => [ 5000, 5000 ],

    Not set by default.

- connection\_timeout => $connection\_timeout

    Specifies connection timeout. If the client could not connect to the server
    after specified timeout, the `on_error` callback is called with the
    `E_CANT_CONN` error. The timeout specifies in seconds and can contain a
    fractional part.

        connection_timeout => 10.5,

    By default the client use kernel's connection timeout.

- lazy => $boolean

    If enabled, the connection establishes at time when you will send the first
    command to the server. By default the connection establishes after calling of
    the `new` method.

    Disabled by default.

- reconnect\_interval => $reconnect\_interval

    If the connection to the server was lost, the client will try to restore the
    connection when you execute next command. By default reconnection is performed
    immediately, on next command execution. If the `reconnect_interval` parameter
    is specified, the client will try to reconnect only after this interval and
    commands executed between reconnections will be queued.

    The client will try to reconnect only once and, if attempt fails, the error
    object is passed to command callback. If you need several attempts of the
    reconnection, you must retry a command from the callback as many times, as you
    need.

        reconnect_interval => 5,

    Not set by default.

- handle\_params => \\%params

    Specifies [AnyEvent::Handle](https://metacpan.org/pod/AnyEvent::Handle) parameters.

        handle_params => {
          autocork => 1,



( run in 1.618 second using v1.01-cache-2.11-cpan-0d23b851a93 )