AnyEvent-Stomper
view release on metacpan or search on metacpan
lib/AnyEvent/Stomper.pm view on Meta::CPAN
$cv->send;
},
);
$cv->recv;
=head1 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:
L<https://stomp.github.io/index.html>
=head1 CONSTRUCTOR
=head2 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...
},
);
=over
=item host => $host
Server hostname (default: localhost)
=item port => $port
Server port (default: 61613)
=item login => $login
The user identifier used to authenticate against a secured STOMP server.
=item passcode => $passcode
The password used to authenticate against a secured STOMP server.
=item vhost => $vhost
The name of a virtual host that the client wishes to connect to.
=item 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. C<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. C<0> means, that the client does not want to receive heart-beats.
heartbeat => [ 5000, 5000 ],
Not set by default.
=item connection_timeout => $connection_timeout
Specifies connection timeout. If the client could not connect to the server
after specified timeout, the C<on_error> callback is called with the
C<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.
=item 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 C<new> method.
Disabled by default.
=item 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 C<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.
=item handle_params => \%params
Specifies L<AnyEvent::Handle> parameters.
handle_params => {
autocork => 1,
( run in 0.906 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )