Catalyst::Controller::MessageDriven
package MyApp::Controller::Queue; use Moose; BEGIN { extends 'Catalyst::Controller::MessageDriven' } sub some_action : Local { my ($self, $c, $message) = @_; # Handle message # Reply with a minimal response message my $response = { type => 'testaction_response' }; $c->stash->{response} = $response; }
A Catalyst controller base class for use with Catalyst::Engine::Stomp, which handles YAML-serialized messages. A top-level "type" key in the YAML determines the action dispatched to.
Deserializes the request into $c->stash->{request}
$c->stash->{request}
Dispatches to method named by the key $c->stash->{request}->{type}
$c->stash->{request}->{type}
Serializes the response from $c->stash->{response}
$c->stash->{response}
In the configuration file add the following to set the value for a parameter
<MessageDriven> type_key foo </MessageDriven>
The hash key the module will try to pull out the received message to call within the controller. This defaults to 'type'.
The serializer used to serialiser/deserialise. See Data::Serializer to see what is available. Defaults to YAML. JSON is anotther that is available.
See information in Catalyst::Engine::Stomp
Copyright (C) 2009 Venda Ltd
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
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.