Submit Your Site For Free!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

Submit Your Site To FRwebSearch

DevWebProFR
FlashNewz
DevWebPro










JMS Event Gateways

By Sean Corfield
Expert Author
Article Date: 2007-05-03

Someone asked on the BACFUG mailing list if you could use ColdFusion with MQ series to do JMS.

I responded that, yes, the example gateway supplied with CFMX 7 is completely generic and should work with any JMS 1.0.2 compliant server.

However, there is not much documentation on this (it was just an example, after all).

Each JMS server has its own custom libraries and classes so some people just assume you have to write a custom gateway.

Not so.

You can just take the server-specific libraries and put them in the ColdFusion class path and then specify the initial context factory class (and the topic connection factory class) in the configuration file.

For example, to use the ActiveMQ server (Apache's free open source JMS), specify this:

providerURL=tcp://localhost:61616
initialContextFactory=
org.apache.activemq.jndi.ActiveMQInitialContextFactory
topicConnectionFactory=TopicConnectionFactory


The config files provided with CFMX 7 as example have details for JRun's built-in JMS server:

providerURL=localhost:2908
initialContextFactory=jrun.naming.JRunContextFactory
topicConnectionFactory=jms/jndi-TopicConnectionFactory
and Fiorano's JMS server:
providerURL=http://wtgdev5.macromedia.com:2001;
http://wtgdev4.macromedia.com:2002
initialContextFactory=
fiorano.jms.runtime.naming.FioranoInitialContextFactory
topicConnectionFactory=cn=primaryTCF,cn=
TopicConnectionFactories,cn=MsgHub,ou=EAI,o=Macromedia,c=US


In the latter example, Fiorano uses LDAP to locate the actual connection factory object. The CFMX 7 JMS event gateway automatically supports both approaches.

You can specify additional context properties for the server using the contextProperties configuration parameter. You specify a comma-delimited list of property names (in the config file) that should be read in and added to the context map when creating the connection.

With Fiorano, for example, this allows you to specify how durable consumers and publishers cache data.

The example gateway is very flexible and is intended to be used "out of the box" with any compliant JMS server, without needing any code changes.

That said, the gateway as it ships today supports topics with both durable and non-durable consumers and publishers (if the JMS server supports this). It does not support queues. It does not support message selectors. It does not support transacted messages.

I'm hoping to have some news around that in due course (completely independent of Scorpio, before you start speculating!).

Comments

About the Author:
Sean is currently Chief Technology Officer for Railo Technologies US. He has worked in IT for over twenty five years, starting out writing database systems and compilers then moving into mobile telecoms and finally into web development in 1997. Along the way, he worked on the ISO and ANSI C++ Standards committees for eight years and is a staunch advocate of software standards and best practice. Sean has championed and contributed to a number of CFML frameworks and was lead developer on Fusebox for two years.



DevWebProFrance is an iEntry, Inc. ® publication - All Rights Reserved Privacy Policy and Legal