CF & ActiveMQ integration?
Anyone tried integrating CF with ActiveMQ? How was the experience? Worth spending time to build a new solution on it? I woul开发者_JS百科d like to learn more on how to use it, any resource you can point me to?
update: Can ActiveMQ run under JRun together with ColdFusion? We're using the Standard Edition.
Thanks
Yes we have used ActiveMQ, in fact we have a project going on at the moment to consume data via a ColdFusion event gateway using ActiveMQ.
Note: we are running on ColdFusion 9.0.1 and we are only consuming messages.
First place to start looking is in your own ColdFusion installation which comes with an ActiveMQ example! Look in {cf_root}\gateway\docs
.
So to get setup you need to:
Add the ActiveMQ jar (activemq-all-5.5.0.jar
) file (available here) to the CF {cf_root}/lib
directory
Move the examples.jar
file in {cf_root}\gateway\lib
to {cf_root}/lib
Check out the {cf_install}/gateway/docs/ActiveMQ_DeveloperGuide.pdf
which will tell you how to create a configuration file. It should look something like this heartbeat.cfg
example:
debug=yes
topic=yes
# the line below needs to be changed
providerURL=tcp://xxx.yyy.com:61616
initialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory
connectionFactory=ConnectionFactory
# ActiveMQ requires fake JNDI entries to lookup topic names
contextProperties=topic.heartbeatTopic
topic.heartbeatTopic=com.xxx.yyy.public.heart_beat
destinationName=heartbeatTopic
Next, set up the event gateway:
- GatewayID: MyTestActiveMQGateway
- Gateway Type: ActiveMQ (this is an option on CF9)
- CFC Path:
c:\foo\MyCFC.cfc
(this is the CFC that will handle data incoming) - Configuration File:
c:\foo\heartbeat.cfg
Your CFC should look like so:
<cfcomponent output="false">
<cffunction name="onIncomingMessage" access="public" output="true">
<cfargument name="data" type="struct" />
<cflog log="application" text="message arrived!" />
</cffunction>
</cfcomponent>
Start your event gateway, and lo and behold you should get messages coming in, or some sort of error.
Hope that helps!
精彩评论