An Architect's View

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

An Architect's View

ColdFusion 8 and ActiveMQ JMS

August 20, 2007 ·

ColdFusion 8 includes two example JMS event gateways. It includes the original JMS event gateway that I wrote as part of CFMX7 and it now includes an updated JMS event gateway that adds a number of new features, such as transacted message consumption, 'map' messages, message properties and message selectors and support for both topics and queues. The original gateway type is called "JMS" and the updated gateway type is called "ActiveMQ". It isn't really specific to the Apache ActiveMQ JMS server but it was developed for a project that used that. The ActiveMQ JMS event gateway is based on the original JMS event gateway but is not entirely backward compatible. In order to implement some of the new features in a nice, clean way I had to rename some of the configuration parameters and change the event data structure passed into CF by the gateway. On the plus side, there is actually a "developer's guide" PDF for the new ActiveMQ gateway (in WEB-INF/cfusion/gateway/docs) that documents all of the data structures and configuration file parameters. If you're considering JMS as an integration technology (and I highly recommend doing so if you need reliable, asynchronous communication between backend systems) then you should look at ActiveMQ (it's free open source) and ColdFusion 8's new event gateway.

Tags: coldfusion

23 responses

  • 1 Ankush Khurana // Jan 3, 2008 at 1:42 PM

    Does ActiveMQ support Queues?
  • 2 Sean Corfield // Jan 3, 2008 at 1:51 PM

    @Ankush, yes, as my blog post states, it has "support for both topics and queues".

    If you have CF8 installed, you can read the developer's guide PDF mentioned above to see what features are supported by the ColdFusion 8 ActiveMQ JMS event gateway.
  • 3 Yolanda Young // May 14, 2008 at 12:25 PM

    I am working on an implementation with ActiveMQ and ColdFusion 8 to allow templates to send messages to a topic. I've made sure that the activemq jar was added to the gateway/lib folder so that it could be added to the classpath. However when a template attempts to call the configured gateway to send a message I get the following error: java.lang.NoSuchMethodError: org.apache.activemq.ActiveMQMessageProducerSupport.getDestination()Ljavax/jms/Destination;
       at org.apache.activemq.ActiveMQMessageProducerSupport.send(

    I saw a few posts metioning that the jar may not be specified on the classpath however I verified that it was by looking at the CF settings summary in CF Administrator. Do you have any insights on this?
  • 4 Jonathan Rowny // Jan 15, 2009 at 1:52 PM

    I'm getting the same error as Yolanda Young above. I checked and I have the right class path in there. Searched around google and some people using it for entirely different purposes seem to think it's a 5.x problem with ActiveMQ. Any ideas?
  • 5 Sean Corfield // Jan 15, 2009 at 2:06 PM

    @Yolanda, @Jonathan - you must use ActiveMQ 4.1.0. That was the "shipping" version when the AMQ gateway was developed for CF8 (and it's the version I use in production today with CF8).
  • 6 Jonathan Rowny // Jan 15, 2009 at 2:28 PM


    Hey, I got it working with 5.2.0, the trick was to include the JAR file in the root of the package, not in the lib of ActiveMQ. It's called ActiveMQ-all-5.2.0.jar and once it's in the class path, everything works great!

    We got messaging setup through a one way firewall so we can have a connection.
  • 7 Sean Corfield // Jan 15, 2009 at 2:36 PM

    @Jonathan, ah, didn't realize you had picked the wrong JAR. Yes, with all versions of ActiveMQ, the key JAR is in the top-level directory. I guess it would help if the PDF docs for AMQ made that clear... Sorry (since I wrote those as well as the two JMS gateways).
  • 8 Ched Cheatham // Feb 6, 2009 at 5:17 AM

    Can some one explain to me what the configuration looks like to send messages between CF boxes? I currently have a gateway setup on both boxes. The sending box has a conf file with the remote boxes ip and outboundOnly=yes. The receiving box has a conf using localhost. Also, ActiveMQ is started on the receiving box.
    I get messages sent from the local box fine. But no messages from the sending box. There are no firewalls and both boxes are on the same subnet and are sending the same topic. What am I doing wrong?
  • 9 Sean Corfield // Feb 6, 2009 at 8:35 AM

    @Chad, add debug=yes to your sending box's JMS config file and start CF from the console so you can see what output is logged. That should show whether the gateway is working or where it is failing.
  • 10 Ched Cheatham // Feb 6, 2009 at 2:38 PM

    Sanx Sean! That helped. Things are working fine now. And to those who are configured running the plain server install (windows) you should stop the cf server service and use {cf.rootdir}\bin\cfstart.bat to start cf in console mode :)
  • 11 Sean Corfield // Feb 6, 2009 at 3:15 PM

    @Chad, cool. What was the problem in the end?
  • 12 Ched Cheatham // Feb 6, 2009 at 7:51 PM

    Ahh, turned out the IT dept gave me the an incorrect TCP/IP Address!
  • 13 Ched Cheatham // Feb 9, 2009 at 11:51 AM

    Can you give me an idea of what configurations have to be in place to have a message sent to a queue on a remote box trigger my local cfc?
  • 14 Jonathan Rowny // Feb 9, 2009 at 12:28 PM

    you just need to specify that queue name in your config file and then onIncomingMessage will get it. Just make sure the address is tcp://yourremoteserver:61616
  • 15 Ched Cheatham // Feb 13, 2009 at 4:31 PM

    I need to add some functionality to allow for BlobMessage. This will of course force me to recompile form source using AMQ version 5 etc. Could anyone provide me with any information that might be helpful during this endeavor with respect to CF and AMQ?.
  • 16 Ched Cheatham // Feb 14, 2009 at 11:43 PM

    Just as a heads up I was able leverage the StreamMessage (see AMQ docs) from the older AMQ so I didn't have to do a whole rewrite for 5. Turns out it was only some minor changes to the source Sean provided with the gateway stuff that came with CF8. Sending large files over the queue is now working great.
  • 17 Kevin Penny // Dec 2, 2009 at 2:09 PM

    Anyone have issues running the same code on a cf9 box? I get the page just being haulted with no error messages on screen - jar is in the right spot - \lib dir on standalone cf install. Just wondering if anyone else is having issues with cf9.
  • 18 Kevin Penny // Dec 2, 2009 at 9:53 PM

    Ok - I just learned that there is a cf9 bug ticket out there for this very issue - cf9 and amq - exact error is "java.lang.NoSuchMethodError: org.apache.activemq.ActiveMQMessageProducerSupport.getDestination()Ljavax/jms/Destination; "
  • 19 realX // Feb 5, 2010 at 7:37 AM

    Hello, does ActiveMQ work with Tibco? I can't get the config to run. I got it going for the original JMS gateway but when I try ActiveMQ I get this "Failed to start gateway: null". The paramters are basically the same.
    I need ActiveMQ for the queue, since original JMS doesn't support queue.

  • 20 Sean Corfield // Feb 6, 2010 at 5:14 PM

    @realX, there are some subtle but important differences between the JMS and ActiveMQ configurations but as long as you got those figured out and you put the Tibco libraries somewhere ColdFusion can find them, it should work - as long as Tibco supports the JEE standard API for JMS...
  • 21 Paulo Lujan // Jun 6, 2010 at 11:59 PM

    For any post re. java.lang.NoSuchMethodError: org.apache.activemq.ActiveMQMessageProducerSupport.getDestination()Ljavax/jms/Destination exception:
    I placed the activemq-all-5.x.x.jar file under <<ColdFusionDir>>\runtime\lib and everything looks good now.
  • 22 Kevin Penny // Nov 9, 2012 at 8:26 PM

    I have been working with the ActiveMQ gateway for years now, and I just had to dig deeper as we encounter odd states with ActiveMQ over time in production. After starting and stopping a cfGateway in the cfadmin 2x, I do a thread dump on the server and see that there are 4 threads that have been generated as a result. The more times you start/stop, the more threads seem to stick around indefinitely (forever from what I see). Is it possible there's some leak here or close not being properly called through cfadmin to Gateway? I'm using cf9 local dev and activemq 5.7 but 5.3 also suffers from the same thing (threads pile up on start/stop). At times I've also seen the Consumer Count not match the number of consumers that should be listed i.e. if there are 16 consumers, I've seen 32. I shut the 16 off, and 16 still remain as 'registered' consumers (which may tell me that these background threads are alive, yet dead, as they typically never take any messages.

    Thread Examples.

    "ActiveMQ Transport: tcp://localhost/" prio=5 tid=98 RUNNABLE
    "ActiveMQ Transport: tcp://localhost/" prio=5 tid=109 RUNNABLE
    "ActiveMQ Transport: tcp://localhost/" prio=5 tid=93 RUNNABLE
    "ActiveMQ Session Task-1" prio=7 tid=115 TIMED_WAITING
    "ActiveMQ Transport: tcp://localhost/" prio=5 tid=114 RUNNABLE
    "ActiveMQ Transport: tcp://localhost/" prio=5 tid=104 RUNNABLE
  • 23 Sean Corfield // Nov 9, 2012 at 9:56 PM

    @Kevin, I haven't touched ACF for over three years now and the ActiveMQ gateway was written about five years ago (after I'd left Adobe - the client I wrote it for donated back to Adobe). Still, you have the source, so feel free to debug it and submit fixes back to Adobe. It's an unsupported open source example, as I recall (I don't have ACF around to check the license).