Catalyst::ActionRole::JMS - role for actions to dispatch based on JMSType
version 1.3
sub an_action : Does('Catalyst::ActionRole::JMS') JMSType('some_type') { # do whatever }
Apply this role to your actions (via the Does attribute) to have the dispatch look at the JMSType of incoming requests (that should really be messages from some queueing system, see Plack::Handler::Stomp for an example). The requests / messages should be dispatched to the namespace of the action.
You should look at Catalyst::Controller::JMS for a more integrated solution using this module together with automatic (de-)serialization.
jmstype
The type to match against. Defaults to the value of a JMSType action attribute, or the action name if such attribute is not present.
JMSType
match
around modifier for the match method of the action class. Extracts the request / message type by calling "_extract_jmstype", and compares it with the value of the "jmstype" attribute by calling "_match_jmstype". If it matches, delegates to the normal match method, otherwise signals a non-match to the dispatched by returning false.
around
_extract_jmstype
my $type = $self->_extract_jmstype($ctx);
Gets the type of the request / message. It first looks in the request headers for jmstype or type keys, then looks into the PSGI environment for a jms.type key.
type
jms.type
_match_jmstype
my $ok = $self->_match_jmstype($request_type);
Simple string equality comparison. Override this if you need more complicated matching semantics.
You can find examples of use in the tests, or at https://github.com/dakkar/CatalystX-StompSampleApps
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>
This software is copyright (c) 2011 by Net-a-porter.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catalyst::ActionRole::JMS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::ActionRole::JMS
CPAN shell
perl -MCPAN -e shell install Catalyst::ActionRole::JMS
For more information on module installation, please visit the detailed CPAN module installation guide.