WARNING: This page still uses the older JMS connectors, and needs updating to the newer JMS drivers available in the current Atomikos releases (also see Using TransactionsEssentials with JMS).

The following information was tested with the default installation for FioranoMQ version: 2007 SP2 Build # 4383

Startup FioranoMQ in XA Mode

You need to start the Fiorano server in XA mode for transactions. Type this on the command line:
fmq.sh -profile FioranoMQ_XA

Example: Adapting the MessageDrivenBank Sample Application

The rest of this page shows how to adapt the supplied JMS-Spring sample (in the download) for FioranoMQ.

JNDI Properties

The FioranoMQ JMS objects are available in JNDI. You will need the following jndi.properties file in your classpath:

Sample Spring XML Config

The following is an adapted sample XML config file for Spring, based on the MessageDrivenBank spring/jms sample in the TransactionsEssentials:

<!-- For non-xa -->
<bean id="datasource" 

        <property name="user"><value>sa</value></property>
        <property name="url"><value>jdbc:HypersonicSQL:SpringNonXADB</value></property>
        <property name="driverClassName"><value>org.hsql.jdbcDriver</value></property>
        <property name="poolSize"><value>1</value></property>
        <property name="connectionTimeout"><value>60</value></property>

<!-- NOTE: for XA datasources: don't forget to call init and close ! -->

<bean id="xaFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiName"><value>primaryXAQCF</value></property>

<bean id="queue" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiName"><value>primaryRDBMSQueue</value></property>

<bean id="bank" class="jdbc.Bank">
        <property name="dataSource"><ref bean="datasource"/></property>

<bean id="messageDrivenBank" class="jms.MessageDrivenBank">
        <property name="bank"><ref bean="bank"/></property>

<!-- Configure the JMS connector; call init to register for recovery! -->
<bean id="queueConnectionFactoryBean"
        class="com.atomikos.jms.QueueConnectionFactoryBean" init-method="init">

        <property name="resourceName"><value>QUEUE_BROKER</value></property>
        <property name="xaQueueConnectionFactory"><ref bean="xaFactory" /></property>   

<!-- Configure the session pool for JMS. This will also manage the transactions
for incoming messages. -->
<bean id="queueReceiverSessionPool" 
        <property name="queueConnectionFactoryBean">
                <ref bean="queueConnectionFactoryBean"/>
        <property name="transactionTimeout"><value>120</value></property>
        <property name="poolSize"><value>1</value></property>
        <property name="queue"><ref bean="queue"/></property>
        <property name="messageListener"><ref bean="messageDrivenBank"/></property>


The MessageDrivenBank

The bank java code does not have to change - all dependencies are concentrated in the spring config file above.

Add Required Fiorano Jars

You should add the Fiorano jars to your classpath - see the Fiorano documentation on what jars you need.

Sending Messages to the Bank

To send a message to the bank, just make sure to send to the same queue, i.e. primaryRDBMSQueue in this example.

Downloadable Sample Code

You can download the entire sample code as a zip file here: fiorano-spring.zip

-- GuyPardon - 24 Sep 2007

Contact Us

Atomikos Corporate Headquarters
Hoveniersstraat, 39/1, 2800
Mechelen, Belgium

E info@atomikos.com
E sales@atomikos.com
T +3215613055

Subscribe to our newsletter

Never miss an update

Copyright 2020 Atomikos BVBA | Our Privacy Policy
By using this site you agree to our cookies. More info. That's Fine