NAME

Catalyst::ActionRole::JMS - role for actions to dispatch based on JMSType

VERSION

version 0.1_02

SYNOPSIS

sub an_action : Does('Catalyst::ActionRole::JMS') JMSType('some_type') {
  # do whatever
}

DESCRIPTION

Apply this role to your actions (via Catalyst::Controller::ActionRole and 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.

ATTRIBUTES

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.

METHODS

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.

_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.

_match_jmstype

my $ok = $self->_match_jmstype($request_type);

Simple string equality comparison. Override this if you need more complicated matching semantics.

AUTHOR

Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>

COPYRIGHT AND LICENSE

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.