Catalyst::Engine::Stomp - write message handling apps with Catalyst.
# 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; }
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.
App entry point. Starts a loop listening for messages.
Overridden to add the source broker to the request, in place of the client IP address.
Overridden to dump out any errors encountered, since you won't get a "debugging" message as for HTTP.
Dispatch according to Stomp frame type.
Dispatch a Stomp message into the Catalyst app.
Log any Stomp error frames we receive.
To install Catalyst::Engine::Stomp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Engine::Stomp
CPAN shell
perl -MCPAN -e shell install Catalyst::Engine::Stomp
For more information on module installation, please visit the detailed CPAN module installation guide.