[Dbix-class] DBIx::Class, Comet, MQ, Profiling and Aspects

Ken McCloskey kmcclosk2k5 at yahoo.com
Fri Jan 8 16:13:32 GMT 2010


I'm in the process of developing a prototype webapp that uses Comet.

The Perl side is CGI::Application and DBIx::Class. I'm using Orbited to do Comet. I communicate to the MQ via STOMP.

I'd like to intercept calls to the DBand turn them into messages that go out to the MQ. 

So, if I do a $schema->resultset('MyTable')->update({ value => $value }), I want to send a JSON message to the MQ along the lines of { op:  'update',  type: 'MyTable', data: { value: 5 }} , which is then received by the STOMPClient on the webpage to update the DOM.

I know there is a mechanism in DBIx::Class, DBIx::Class::Storage::Statistics used for getting access to the SQL and it is possible to use this to intercept and create the JSON messages - however - at that point it is a SQL string which requires parsing, which is not necessarily ideal. Is there a higher-level way to do this with the DBIx::Class API?

The approach that I'm taking today is to use Adam Kennedy's Aspect module to install pointcuts over the basic DBIx::Class::ResultSet methods I'm interested in - does that seem reasonable and can you envision any problems with that approach?

Given the shift to an world in which webapps are more event-driven (WebSockets,AMQP,XMPP) I can see this as a scenario that will become more common, what do you think?

Thanks to everyone who makes this module possible.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20100108/e9968ed7/attachment.htm


More information about the DBIx-Class mailing list