AnyEvent-STOMP-Client

 view release on metacpan or  search on metacpan

README.pod  view on Meta::CPAN

  $stomp_client->connect();

  $stomp_client->on_connected(
      sub {
          my $self = shift;

          $self->subscribe('/queue/test-destination');

          $self->send(
              '/queue/test-destination',
              {'content-type' => 'text/plain',},
              "Hello World!"
          );
      }
  );

  $stomp_client->on_message(
      sub {
          my ($self, $header, $body) = @_;
          print "$body\n";
      }

README.pod  view on Meta::CPAN

String, mandatory. The destination to which to send the message to.

=item C<$header>

Hash, optional, empty by default. Arbitrary headers included in the C<SEND>
frame. See the STOMP documentation for supported headers.

=item C<$body>

String, optional, empty by default. The body of the message, according to the
content-type specified in the header.

=back

=head2 $client->ack $ack_id, $transaction_id

Send an C<ACK> frame to acknowledge a received message.

=over

=item C<$ack_id>

examples/basic.pl  view on Meta::CPAN

$stomp_client->connect();

$stomp_client->on_connected(
    sub {
        my $self = shift;

        $self->subscribe('/queue/test-destination');

        $self->send(
            '/queue/test-destination',
            {'content-type' => 'text/plain',},
            "Hello World!"
        );
    }
);

$stomp_client->on_message(
    sub {
        my ($self, undef, $body) = @_;
        print "$body\n";
        $self->disconnect;

examples/sample-producer.pl  view on Meta::CPAN

my $stomp_client = new AnyEvent::STOMP::Client();
$stomp_client->connect();

$stomp_client->on_connected(
    sub {
        my $self = shift;
        print "Connection established!\n";

        $self->send(
            '/queue/test-destination',
            {'persistent' => 'true', 'content-type' => 'text/plain',},
            "Hello World!"
        );

        $self->disconnect;
    }
);

$stomp_client->on_disconnected(sub { $cv->send; });

$cv->recv;

lib/AnyEvent/STOMP/Client.pm  view on Meta::CPAN

        $headers->{destination} = $destination;
    }
    else {
        croak "Would you mind supplying me with a destination?";
    }

    unless (defined $headers->{'content-length'}) {
        $headers->{'content-length'} = length $body || 0;
    }

    unless (defined $headers->{'content-type'}) {
        carp "It is strongly recommended to set the 'content-type' header.";
    }

    $self->send_frame('SEND', $headers, $body);
}

sub ack {
    my ($self, $ack_id, $transaction) = @_;

    unless ($ack_id) {
        croak "I do really need the message's ack header to ACK it.";

lib/AnyEvent/STOMP/Client.pm  view on Meta::CPAN

  $stomp_client->connect();

  $stomp_client->on_connected(
      sub {
          my $self = shift;

          $self->subscribe('/queue/test-destination');

          $self->send(
              '/queue/test-destination',
              {'content-type' => 'text/plain',},
              "Hello World!"
          );
      }
  );

  $stomp_client->on_message(
      sub {
          my ($self, $header, $body) = @_;
          print "$body\n";
      }

lib/AnyEvent/STOMP/Client.pm  view on Meta::CPAN

String, mandatory. The destination to which to send the message to.

=item C<$header>

Hash, optional, empty by default. Arbitrary headers included in the C<SEND>
frame. See the STOMP documentation for supported headers.

=item C<$body>

String, optional, empty by default. The body of the message, according to the
content-type specified in the header.

=back

=head2 $client->ack $ack_id, $transaction_id

Send an C<ACK> frame to acknowledge a received message.

=over

=item C<$ack_id>



( run in 2.281 seconds using v1.01-cache-2.11-cpan-524268b4103 )