[Catalyst] Catalyst::Model::RabbitMQ

Ian Docherty catalyst at iandocherty.com
Sat Aug 18 20:43:16 GMT 2012


On 18 August 2012 20:36, Gianni Ceccarelli <dakkar at thenautilus.net> wrote:
> I'm using a combination of CatalystX::ComponentsFromConfig and Net::Stomp::Producer. The first (t0m's code, even if released by me) allows you to avoid writing essentially empty model classes (and to apply roles via configuration file). The second is the one that actually deals with messaging. As the name implies it's using STOMP, but there's actually rather little in the interface that depends on it. It works like this:
>
> - a "send" method takes a destination (queue name, whatever), a hashref of headers (including a 'type', that I imagine being similar to RabbitMQ's routing key), and a byte string for the message payload
> - if the message payload is a reference, it is passed through a serialiser
> - a "transform_and_send" method allows you to pass some internal representation, and having the logic to transform it into a message in a specialised class
>
> We've been using something very similar at $work for a coulpe of years now, and it seems to be simple and flexible enough.
> --
>   dakkar - mobilis in mobile
>

It's 'normal' not to create Catalyst specific models, but to create
your model outside of Catalyst (so you can use it in things like cron
jobs for example) in which case you just use a thin adaptor class. See
Catalyst::Model::Adaptor

If you do it that way you don't need to publish a cpan module at all.

- icydee



More information about the Catalyst mailing list