[Quickfix-developers] [qfj] Publishing Messages to JMS
Brought to you by:
orenmnero
|
From: Brad H. <Bra...@gb...> - 2005-09-12 00:30:52
|
Hi,=20 I'm having a look at quickfixj (quickfixj-1.0.0-beta1-src.tar.gz) at the moment with a view to making it exchange messages with my application via JMS. I'm instantiating quickfixj from a web app listener using Spring (http://www.springframework.org). After a little jiggling I've been able connect to the order executor sample and have messages published to JMS as object messages. quickfixj is certainly easier to use for this sort of thing than trying to make jni play nicely with the container. I came across a few problems along the way which I was able to find a solution to: The DataDictionary class isn't serializable, and messages keep a reference to this class which causes a java.io.NotSerializableException: quickfix.DataDictionary when I try to publish to JMS. =20 There's nothing stopping the DataDictionary and dependent classes from being made Serializable, but it may not be desirable to be sending this on every message. I notice Message's clone method has been overridden to not copy the data dictionary, so this can be used to workaround the problem. What impact will this have when I go to actually trying to use the message on the other side of the JMS queue? I haven't got to the stage of trying messages with repeating groups yet. Many of the Serializable classes are missing serialVersionUID fields. I think this is only a practical problem if you're using different compiled classes on either side of the serialization (I was initially publishing with eclipse compiled classes and receiving with the ant built jar and ran into some serialVersionUID mismatch problems). I wanted to be able to pick up the data dictionaries from my classpath. DefaultSessionFactory tries to load using FileInputStream(path) with no easy way to plug in something else. As a temporary workaround I have replaced this with a Spring resource loader: ResourceLoader defaultResourceLoader =3D new DefaultResourceLoader(); dataDictionary =3D new DataDictionary(defaultResourceLoader.getResource(path).getInputStream()) ; I can now specify the data dictionary location as classpath:FIX42.xml to pick it up from the classpath, FIX42.xml to read from file, or even http://www.quickfixengine.org/FIX42.xml if I want to eat up some bandwidth :) Obviously this approach isn't directly suitable for quickfixj unless you want to add Spring as a dependency. Perhaps a pluggable DataDictionaryFactory would be helpful? quickfix.SocketInitiator.onPoll() throws a ClassCastException if it gets a Session object from the event queue - it needs the same instanceof checks as onBlock(). quickfix.netty.AbstractSocketInitiator.quickfixSessions never gets filled in as far as I can tell, so isLoggedOn() and getSessions() don't work. There were also some I didn't look into further: - If I start an initiator and send a message before the logon process is completed the message doesn't go anywhere. If I explicitly wait until the session is logged on then it works fine. - If a session is disconnected it doesn't seem to logon again. It says 'Initiating Logon' but nothing further happens. Sorry if I seem to be pointing out a lot of negatives - I do realise quickfixj is beta. Keep up the good work! Regards, Brad. |