An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

JMS Event Gateways

May 2, 2007 · No Comments

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!).

Tags: coldfusion

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Leave this field empty: