Naveed Massjouni > POE-Component-MessageQueue > POE::Component::Server::Stomp

Download:
POE-Component-MessageQueue-0.3001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.2.3   Source  

NAME ^

POE::Component::Server::Stomp - A generic Stomp server for POE

SYNOPSIS ^

  use POE qw(Component::Server::Stomp);
  use Net::Stomp::Frame;
  use strict;

  POE::Component::Server::Stomp->new(
    HandleFrame        => \&handle_frame,
    ClientDisconnected => \&client_disconnected,
    ClientErrorr       => \&client_error
  );

  POE::Kernel->run();
  exit;

  sub handle_frame
  {
    my ($kernel, $heap, $frame) = @_[ KERNEL, HEAP, ARG0 ];

    print "Recieved frame:\n";
    print $frame->as_string() . "\n";

    # allow Stomp clients to connect by playing along.
    if ( $frame->command eq 'CONNECT' )
    {
      my $response = Net::Stomp::Frame->new({
        command => 'CONNECTED'
      });
      $heap->{client}->put( $response->as_string . "\n" );
    }
  }

  sub client_disconnected
  {
    my ($kernel, $heap) = @_[ KERNEL, HEAP ];

    print "Client disconnected\n";
  }

  sub client_error
  {
    my ($kernel, $name, $number, $message) = @_[ KERNEL, ARG0, ARG1, ARG2 ];

    print "ERROR: $name $number $message\n";
  }

DESCRIPTION ^

A thin layer over POE::Component::Server::TCP that parses out Net::Stomp::Frames. The synopsis basically covers everything you are capable to do.

For information on the STOMP protocol:

http://stomp.codehaus.org/Protocol

For a full-fledged message queue that uses this module:

POE::Component::MessageQueue

SEE ALSO ^

POE::Component::Server::TCP, POE::Filter::Stomp, Net::Stomp

BUGS ^

Probably.

AUTHORS ^

Copyright 2007-2010 David Snopek.

syntax highlighting: