NAME

Catalyst::Engine::Stomp - write message handling apps with Catalyst.

SYNOPSIS

# In a server script:

BEGIN {
  $ENV{CATALYST_ENGINE} = 'Stomp';
  require Catalyst::Engine::Stomp;
}

MyApp->config->{Engine::Stomp} =
 {
   hostname => '127.0.0.1',
   port     => 61613,
 };
MyApp->run();

# In a controller, or controller base class:
use base qw/ Catalyst::Controller::MessageDriven /;

# then create actions, which map as message types
sub testaction : Local {
    my ($self, $c) = @_;

    # Reply with a minimal response message
    my $response = { type => 'testaction_response' };
    $c->stash->{response} = $response;
}

DESCRIPTION

Write a Catalyst app connected to a Stomp messagebroker, not HTTP. You need a controller that understands messaging, as well as this engine.

This is single-threaded and single process - you need to run multiple instances of this engine to get concurrency, and configure your broker to load-balance across multiple consumers of the same queue.

Controllers are mapped to Stomp queues, and a controller base class is provided, Catalyst::Controller::MessageDriven, which implements YAML-serialized messages, mapping a top-level YAML "type" key to the action.

METHODS

run

App entry point. Starts a loop listening for messages.

prepare_request

Overridden to add the source broker to the request, in place of the client IP address.

finalize_headers

Overridden to dump out any errors encountered, since you won't get a "debugging" message as for HTTP.

handle_stomp_frame

Dispatch according to Stomp frame type.

handle_stomp_message

Dispatch a Stomp message into the Catalyst app.

handle_stomp_error

Log any Stomp error frames we receive.