RE: [Quickfix-developers] Using quickfix in jboss
Brought to you by:
orenmnero
From: Brad H. <Bra...@gb...> - 2004-10-08 01:56:28
|
Thanks for the replies. Jem, I think you're correct that from a pure J2EE standpoint it should be a RA. Since a fix engine would require incoming I think this would require JCA 1.5 (ie, JBoss 4) which we aren't comfortable deploying yet. If time permits I would like to try this out though. =20 As an managed bean I don't think it needs to be constrained by the J2EE spec, and we could in theory deploy it outside an appserver (using mx4j, for example). =20 =20 At this stage I'm leaning towards not trying to integrate quickfix in the same JVM as the appserver - this should provide some protection from one interfering with the other. =20 Cheers, Brad. ________________________________ From: Day, Jem BGI SF [mailto:Je...@ba...]=20 Sent: Friday, 8 October 2004 7:12 AM To: Oren Miller; Brad Harvey Cc: qui...@li... Subject: RE: [Quickfix-developers] Using quickfix in jboss Take this with a pinch-of-salt.... =20 From a pure J2EE standpoint shouldn't QuickFix (or any Fix engine) be deployed as a Connector/ResourceAdaptor (ie JCA) . I'm not suggesting that this is easy, or even possible but it's the J2EE server that is meant to supply Threads, Timers etc. so that it can control the overall resource utilization. =20 Jem. -----Original Message----- From: qui...@li... [mailto:qui...@li...]On Behalf Of Oren Miller Sent: Thursday, October 07, 2004 8:25 AM To: Brad Harvey Cc: qui...@li... Subject: Re: [Quickfix-developers] Using quickfix in jboss =09 =09 Brad,=20 There were a couple of thread on using QuickFIX with jboss. Maybe some of these will be helpful to you. At the very least they will show you some contacts for people who have successfully integrated QuickFIX with jboss. I'll create a bug report for this and see if we can duplicate the problem.=20 http://sourceforge.net/mailarchive/message.php?msg_id=3D4160033=20 http://sourceforge.net/mailarchive/message.php?msg_id=3D4164853=20 http://sourceforge.net/mailarchive/message.php?msg_id=3D3668061=20 --oren=20 On Oct 6, 2004, at 9:04 PM, Brad Harvey wrote:=20 Hi All,=20 I am investigating using quickfix in a jmx mbean in jboss and have run into some troubles. Has anyone had any success running it in an appserver before?=20 At present I am able to run my code as a standard java app (a junit test in eclipse, to be precise) and it seems to work ok - it connects to the executor sample application and exchanges logon/logoff messages.=20 However, when I fire it up within jboss I run into some troubles. The loadLibrary call completes ok, and I am able to make calls through the jni layer. For example, I can get configuration exceptions back, and I can get Session created log messages. Unfortunately, as soon as the Connection succeeded log is written I get a dialog pop up:=20 Microsoft Visual C++ Runtime Library=20 Runtime Error!=20 Program c:\j2sdk1.4.2\bin\java.exe=20 abnormal program termination=20 When I hit ok on the dialog jboss ends (but it actually continues to run until I hit ok). What is especially strange is that it doesn't do a stack dump (like it does when you get a Unexpected Signal : EXCEPTION_ACCESS_VIOLATION) - the java process just dies.=20 I am using:=20 windows xp=20 quickfix 1.9.2 vc7 binary=20 jboss 3.2.5=20 I have also tried with the vc6 binary. This just terminates jboss immediately with an abnormal termination error message. I also tried with quickfix 1.8 and got the same error. I have tried as both initiator and acceptor and get the same problem both ways. =20 Here's some sample log messages. The first set were from the unit test, the second are from the appserver.=20 20041006-22:57:35 : Created session=20 20041006-22:57:37 : Connecting to 127.0.0.1 on port 65001=20 20041006-22:57:37 : Connection succeeded=20 20041006-22:57:38 : Initiated logon request=20 20041006-22:57:38 : Received logon response=20 20041006-22:57:38 : Received ResendRequest FROM: 13 TO: 0=20 20041006-22:57:38 : Sent SequenceReset TO: 15=20 20041006-22:58:27 : Initiated logout request=20 20041006-22:58:27 : Received logout response=20 20041006-22:58:27 : Disconnecting=20 20041006-22:58:55 : Created session=20 20041006-22:58:55 : Connecting to 127.0.0.1 on port 65001=20 20041006-22:58:55 : Connection succeeded=20 (crashes now)=20 Any hints on what I might be doing wrong (or why I should avoid the whole concept) would be appreciated. I've included the code and settings below. It's pretty close to the samples given in the documentation, with some extra stuff to make it an mbean (the interface).=20 Thanks,=20 Brad.=20 # default settings for sessions=20 [DEFAULT]=20 ConnectionType=3Dinitiator=20 ReconnectInterval=3D60=20 SenderCompID=3DTW=20 FileStorePath=3DD:\tmp\fixstore=20 FileLogPath=3DD:\tmp\fixstore=20 # session definition=20 [SESSION]=20 # inherit ConnectionType, ReconnectInterval and SenderCompID from default=20 BeginString=3DFIX.4.2=20 TargetCompID=3DARCA=20 StartTime=3D00:00:00=20 EndTime=3D23:59:59=20 HeartBtInt=3D20=20 SocketConnectPort=3D65001=20 SocketConnectHost=3D127.0.0.1=20 DataDictionary=3DD:\downloads\quickfix\spec\FIX42.xml=20 /*=20 * Two files, HelloWorld.java (which implements the MBean) and HelloWorldMBean.java which defines it.=20 * I compile these, jar them and stick them in the jboss deploy directory.=20 * The quickfix.jar also lives in there, but quickfix_jni.dll is in the $JBOSS_HOME/bin directory.=20 *=20 * The deployment descriptor is fairly simple, just specifies that HelloWorld.jar and quickfix.jar are on the classpath=20 * and sets the helloMessage string to the name of the settings file and sets acceptor to true or false.=20 *=20 * The MBean deploys fine, but when I invoke startSessions() and a connection is established it crashes :(=20 */=20 /* HelloWorld.java */=20 package com.test.mbean;=20 import java.io.FileInputStream;=20 import quickfix.Acceptor;=20 import quickfix.Application;=20 import quickfix.DefaultMessageFactory;=20 import quickfix.DoNotSend;=20 import quickfix.FieldNotFound;=20 import quickfix.FileLogFactory;=20 import quickfix.FileStoreFactory;=20 import quickfix.IncorrectDataFormat;=20 import quickfix.IncorrectTagValue;=20 import quickfix.Initiator;=20 import quickfix.LogFactory;=20 import quickfix.Message;=20 import quickfix.MessageFactory;=20 import quickfix.MessageStoreFactory;=20 import quickfix.RejectLogon;=20 import quickfix.SessionID;=20 import quickfix.SessionSettings;=20 import quickfix.SocketAcceptor;=20 import quickfix.SocketInitiator;=20 import quickfix.UnsupportedMessageType;=20 public class HelloWorld implements HelloWorldMBean, Application {=20 =20 /* should really rename this var, left over from my hello world mbean.... */=20 private String helloMessage =3D "d:\tmp\session.ini"; private boolean isAcceptor =3D true;=20 private Acceptor acceptor;=20 private Initiator initiator;=20 static {=20 System.loadLibrary("quickfix_jni");=20 }=20 /**=20 * @return Returns the helloMessage.=20 */=20 public String getHelloMessage() {=20 return helloMessage;=20 }=20 /**=20 * @param helloMessage The helloMessage to set.=20 */=20 public void setHelloMessage(String helloMessage) {=20 this.helloMessage =3D helloMessage;=20 }=20 public String startSession() {=20 try {=20 SessionSettings settings =3D new SessionSettings(new =20 FileInputStream(helloMessage));=20 MessageStoreFactory storeFactory =3D new FileStoreFactory(settings);=20 LogFactory logFactory =3D new FileLogFactory(settings);=20 MessageFactory messageFactory =3D new DefaultMessageFactory();=20 if (isAcceptor) {=20 acceptor =3D new SocketAcceptor=20 (this, storeFactory, settings, logFactory, =20 messageFactory);=20 acceptor.start();=20 } else {=20 initiator =3D new SocketInitiator=20 (this, storeFactory, settings, logFactory, =20 messageFactory);=20 initiator.start();=20 System.out.println("Initiator started");=20 }=20 return getHelloMessage();=20 } catch (Exception e) {=20 return "ERROR: " + e.getMessage();=20 }=20 }=20 public void stopSession() {=20 if (acceptor !=3D null) {=20 acceptor.stop();=20 }=20 if (initiator !=3D null) {=20 initiator.stop();=20 }=20 }=20 /**=20 * @return Returns the acceptor.=20 */=20 public boolean isAcceptor() {=20 return isAcceptor;=20 }=20 /**=20 * @param acceptor The acceptor to set.=20 */=20 public void setAcceptor(boolean acceptor) {=20 this.isAcceptor =3D acceptor;=20 }=20 /* auto generated methods for application */=20 /* (non-Javadoc)=20 * @see quickfix.Application#onCreate(quickfix.SessionID)=20 */=20 public void onCreate(SessionID arg0) {=20 System.out.println("Session created: " + arg0); }=20 /* (non-Javadoc)=20 * @see quickfix.Application#onLogon(quickfix.SessionID)=20 */=20 public void onLogon(SessionID arg0) {=20 System.out.println("Logon: " + arg0);=20 }=20 /* (non-Javadoc)=20 * @see quickfix.Application#onLogout(quickfix.SessionID)=20 */=20 public void onLogout(SessionID arg0) {=20 // TODO Auto-generated method stub=20 }=20 /* (non-Javadoc)=20 * @see quickfix.Application#toAdmin(quickfix.Message, =20 quickfix.SessionID)=20 */=20 public void toAdmin(Message arg0, SessionID arg1) { // TODO Auto-generated method stub=20 }=20 /* (non-Javadoc)=20 * @see quickfix.Application#toApp(quickfix.Message, =20 quickfix.SessionID)=20 */=20 public void toApp(Message arg0, SessionID arg1) throws DoNotSend {=20 // TODO Auto-generated method stub=20 }=20 /* (non-Javadoc)=20 * @see quickfix.Application#fromAdmin(quickfix.Message, =20 quickfix.SessionID)=20 */=20 public void fromAdmin(Message arg0, SessionID arg1) throws =20 FieldNotFound, IncorrectDataFormat, IncorrectTagValue, RejectLogon {=20 // TODO Auto-generated method stub=20 }=20 /* (non-Javadoc)=20 * @see quickfix.Application#fromApp(quickfix.Message, =20 quickfix.SessionID)=20 */=20 public void fromApp(Message arg0, SessionID arg1) throws =20 FieldNotFound, IncorrectDataFormat, IncorrectTagValue, =20 UnsupportedMessageType {=20 // TODO Auto-generated method stub=20 }=20 }=20 /* HelloWorldMBean.java */=20 /*=20 * The MBean interface declaration defines what=20 * methods are availble to the mbean server=20 */=20 package com.test.mbean;=20 public interface HelloWorldMBean {=20 public void setHelloMessage(String helloMessage);=20 public String getHelloMessage();=20 public void setAcceptor(boolean acceptor);=20 public boolean isAcceptor();=20 public String startSession();=20 public void stopSession();=20 }=20 |