Re: [Quickfix-developers] FIX Session Dropped
Brought to you by:
orenmnero
|
From: gm-mrktc <gm...@ma...> - 2006-12-07 20:43:34
|
Nick Volpe wrote: > > In my > implementation, each FIX application message I receive needs to update > certain records in the DB behind my investment management system. I've > noticed that on rare occasions, this can take up to a minute and prevents > my application from sending heartbeat messages. > Nick, for applications like this, we have become quite enamored of the idea of a Staged Event Driven Architecture, SEDA (http://www.eecs.harvard.edu/~mdw/proj/seda/). When it comes down to it, it really is a matter of passing messages through a queue as Nick Fortescue suggested, but it's a useful abstraction that you can implement yourself, or there are many frameworks that implement it in one way or another. The basic idea is that you break up your message processing into a number of "stages", and in the most basic setup, you have one thread per stage that are connected by a thread-safe queue like the ones found in java.util.concurrent. It requires a little bit of a change in how you think about coding your application, because you need to start thinking in "message passing" terms rather than "method invoking" terms. So returning values and throwing exceptions from your stages become harder. However we find it to be a logical construct that likely has good scaling characteristics. There are several projects and libraries that will manage the staging framework for you, allowing you to implement just the "stage" logic. We were using a project called JCyclone for a while, which provided a basic framework. However we now use a "message-driven POJO" setup using ActiveMQ and Spring (a good--if a little out of date--tutorial is here: http://blog.interface21.com/main/2006/08/11/message-driven-pojos/). Other libraries like Mule, and MINA implement SEDA in their own way, but we found neither of these really fit our needs. It may be the fact that these frameworks are overkill for what you need, and you really just want to implement a simple queue-and-two-threads solution that does exactly what you need. But feel free to see how we do it. All the code for our order routing server is here http://trac.marketcetera.org/trac.fcgi/browser/platform/trunk/oms/src/main/java/org/marketcetera/oms. OutgoingMessageHandler.java implements our main "stage", with its entry point, "handleMessage". Then Spring and ActiveMQ do the heavy lifting. A sample Spring configuration can be found here http://trac.marketcetera.org/trac.fcgi/browser/platform/trunk/oms/src/main/resources/oms.xml (it includes some of the other xml files in the same directory). Anyway, hope this helps. graham -- View this message in context: http://www.nabble.com/FIX-Session-Dropped-tf2754627.html#a7746960 Sent from the QuickFIX - Dev mailing list archive at Nabble.com. |