[Quickfix-developers] Integrate socket connections into application-wide async socket loop
Brought to you by:
orenmnero
|
From: Sean L. <sea...@da...> - 2006-06-15 20:51:45
|
Hi all, I want to integrate QuickFix into my Python proxy software's socket event loop - the purpose is to translate a proprietary protocol into FIX. My proxy runs a simple async loop using poll(2) on Linux as it happens, although that's not so important I don't think. So to efficiently integrate a QuickFix event loop into my proxy, ideally I'd like a way to pull out the socket FDs and use them in my overall poll call. Then it's easy I figure - I can use SocketInitiator::poll to handle the socket event using the existing mechanisms. Although this isn't superclean, as the socket FD is a fairly ubiquitous token on a *nix box, it doesn't seem obscene to me to pull that out of the socket internals for use in a larger event loop as something to poll for events using kernel-level mechanisms. From the highly elegant use of patterns in QuickFix I'd hazard a guess that others here might accuse me of poor taste ;-) The rub is: is there any reasonable way to do pull out the socket FD without modifying the C++ engine? I really like the simplicity of hooking in via the SWIG bindings, and I'd like to be able to use QuickFix unpatched if possible simply for ease of maintenance (although I'm competent enough in C++ to hack the source if necessary). I guess in C++ I would subclass the strategy as that owns the FDs, and then use a replacement SocketInitiator that subclasses my customized strategy and Initiator. Would that be the right way to go? Could I actually do this all successfully in pure Python? If I can, then I'll still have to rewrite SocketInitiator in Python right? Or is there a more elegant approach to my basic problem that I'm not seeing? Thanks in advance for any insights, Sean (ObAppreciation: thanks to those responsible for QuickFix - it's a great joy to find a requirement met by such a competently written and packaged piece of free software) -- Sean Legassick se...@da... |