• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JBOSS QuickFIX Integration Summary

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

You might have seen my requests for help. I have solved most of the issues and here is my summary of findings.

QuickFIX and JBoss Integration Findings
---------------------------------------
Accessing dll and libs
----------------------
Place the dll and lib file in jbosshome/server/default/lib where default is the
configuration in which I run my jboss.
Also modify the run bat file in jbosshome/bin directory to

rem Setup JBoss specific properties RK added the java.library.path
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME% -Djava.library.path=%DIRNAME%\..\server\default\lib;

Locate "set JAVA_OPTS" and add -Djava.library.pah to where you choose to place
dll and lib files.
---------------------
Accessing Static Files
----------------------
such as cfg files for quickfix and spec files
-------------method 2 -- not useful for QuickFix as it needs FileInputStream
void take2(String configFile)
{
try {
System.err.println ("begin take2::");
InputStream in = Thread.currentThread().
getContextClassLoader().getResourceAsStream( configFile);
BufferedInputStream bis = new BufferedInputStream(in) ;
StringBuffer sbuf = new StringBuffer() ;
int ch=0;
while ( ( ch=bis.read()) != -1 )
{
sbuf.append((char) ch);
}
System.err.println (sbuf);
System.err.println ("end take2::");
System.err.flush();
}
catch(Exception ex) { ex.printStackTrace() ; }
}
// recommended by Adrian at JBoss in an article.
------------------method ---------using System.properties � this works for me�
FileInputStream getFileInputStream(String configFile)
{
FileInputStream fis =null;

String jbosshome = System.getProperty("jboss.server.home.dir");
if (jbosshome != null) {
// returns server/config[default/all]
// I have placed the cfg file in jboss-4.0.2/server/default/conf
// jboss-4.0.2/server/default comes out as jbosshome
// I add conf so cfg files do not clutter out the JBossHome directory
String filename = jbosshome + File.separator + "conf"+File.separator+ configFile ;
try {
return new FileInputStream(filename) ;
}
catch(Exception ex){log.error(filename+" file not found "+ex.toString());}
}
return fis;
}

-----------------------method 3 -- does not work for me yet...
Class c = this.getClass();
URL url = c.getResource(configFile);
File f = new File(new URI(url.toString()));
FileInputStream fis = new FileInputStream(f) ;
//The cfg file must reside in the same jar or archive as the class C
//I get an exception "URI not Hierarchical"
------------------------
jboss-service.xml

(1) the file should be named exactly as jboss-service.xml
(2) the file must be located in META-INF
(3) The contents of the file should look like
-------------begin
<?xml version="1.0" encoding="UTF-8"?>

<server>
<classpath codebase="lib" archives="fixservice.jar, quickfix.jar" />
<mbean code="com.fmcp.fixservice.FIXService" name="fmcp.com:service=FIXService">
<attribute name="JNDIName">java:/FIXService</attribute>
<attribute name="configFile">fixservice.cfg</attribute>
<attribute name="senderCompID">FMCP</attribute>
<attribute name="senderSubCompID">FMCPSUB</attribute>
<attribute name="targetCompID">LTS</attribute>
<attribute name="targetSubCompID">LTSSUB</attribute>
<attribute name="beginString">FIX.4.2</attribute>
</mbean>
</server>
--------------end general mbean observation
// MBean setup
Three different things are required to get it deployed
jboss-service.xml in META-INF as shown above in a sar file

MBean interface as shown below. The interface must be named XXXMBean
MBean interface implementation following that.
By changing the name to other unique strings you can have more than one
mbean in one JBoss
For each attribute you should have appropriate get and set methods
--- I am including my MBean interface and signature for the implementation

import javax.naming.NamingException;
import org.jboss.system.ServiceMBean;

public interface FIXServiceMBean extends org.jboss.system.ServiceMBean
{// XXXMBean where XXX --> FIXService


public String getJNDIName();
public void setJNDIName(String jndiName) throws NamingException;
public String getconfigFile () ; // returns the file specified in jndi
public void setconfigFile(String v) ;
// all msgs going out of this server will carry this cid for tag 49
public String getsenderCompID() ; // returns as specified in jndi [RSSJ]
public void setsenderCompID(String v) ;
public String getsenderSubCompID() ; // RSSJ Tag 50
public void setsenderSubCompID(String v) ;
public String gettargetCompID() ; // RSSJ Tag 56
public void settargetCompID(String v) ;
public String gettargetSubCompID() ; // RSSJ Tag 57
public void settargetSubCompID(String v) ;

public String getbeginString() ; // returns as specified in jndi RSSJ
public void setbeginString(String v) ;
}

// note the method name is get/set appended to the attribute name defined in
// jboss-service.xml
// if you do not wish jmx to be able to read or write leave out get or set method
--------------
mbean skeleton implementation
--------------
public class FIXService extends org.jboss.system.ServiceMBeanSupport implements FIXServiceMBean
{
// I have used most of what mike had posted in SourceForge
// you may want to do the same article reference provided below
}
--------------SAR FILE ----
(you can create a sar file with jar cvf command and rename it to sar)
jar cvf <jarfile.jar> ant-build-dir/META-INF com *.jar *.dll *.lib
rename jarfile.jar sarfile.sar
(sar files Service Archives are HOT-DEPLOYABLE in JBOSS ...
when a sar file is moved into deploy file the MBean is loaded)
----------References that I used for code samples, guidance and self checking and consultation
http://comments.gmane.org/gmane.comp.finance.quickfix.user/168# [matt]
http://article.gmane.org/gmane.comp.finance.quickfix.devel/731 [patrick]
http://sourceforge.net/mailarchive/forum.php?forum_id=103&thread_id=7019969 [mike]
----------Current Status of my project
MBean is loaded and says connected and then the whole jboss exits. No further information is
available. No output nothing. No exception. Just exits. I think I saw a posting to the effect
before. I have to search.
The CP (executor) does not report any connection activity.
The stack is built on a package which I have tested outside MBean. So this new behavior
of abrupt exit is not due to QF but JBoss/QF integration.
------------QF Recommendation 2 QF
--pure java implementation of QF
-- make settings settable one attribute at a time so Settings can be created from jboss-service.xml
-- by JMX
-- Settings goes through State Matrix... uninitialized -- initialization in progress - init completed
--------DISCLAIMER-------
All this information compiled over the past 4 weeks submitted in earnest to reduce similar work
May or may not work in your environment. No warranties implied or otherwise.
All the details are here and I will try to help <<<<WHEN I CAN>>>> if there are doubts
-------------------------
reply
    Bookmark Topic Watch Topic
  • New Topic