CF和ActiveMQ集成?

Hen*_*nry 4 coldfusion activemq-classic

有人试过将CF与ActiveMQ集成吗?经历如何?值得花时间建立一个新的解决方案吗?我想了解更多关于如何使用它的信息,您可以指点我的任何资源?

更新: ActiveMQ可以和JRun一起在ColdFusion下运行吗?我们正在使用标准版.

谢谢

Cia*_*her 11

是的,我们使用了ActiveMQ,实际上我们目前正在进行一个项目,通过使用ActiveMQ的ColdFusion事件网关来使用数据.

注意:我们在ColdFusion 9.0.1上运行,我们只使用消息.

第一个开始寻找的是你自己的ColdFusion安装,它带有一个ActiveMQ示例!看看{cf_root}\gateway\docs.

因此,要获得设置,您需要:

将ActiveMQ jar(activemq-all-5.5.0.jar)文件(此处提供)添加到CF {cf_root}/lib目录

移动examples.jar文件{cf_root}\gateway\lib{cf_root}/lib

查看{cf_install}/gateway/docs/ActiveMQ_DeveloperGuide.pdf哪个将告诉您如何创建配置文件.它应该看起来像这样的heartbeat.cfg例子:

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
Run Code Online (Sandbox Code Playgroud)

接下来,设置事件网关:

  • GatewayID:MyTestActiveMQGateway
  • 网关类型:ActiveMQ(这是CF9上的一个选项)
  • CFC路径:( c:\foo\MyCFC.cfc这是将处理数据传入的CFC)
  • 配置文件: c:\foo\heartbeat.cfg

你的CFC应该是这样的:

<cfcomponent output="false">

    <cffunction name="onIncomingMessage" access="public" output="true">
        <cfargument name="data" type="struct" />

        <cflog log="application" text="message arrived!" />


    </cffunction>

</cfcomponent>
Run Code Online (Sandbox Code Playgroud)

启动你的事件网关,看看你应该收到消息,或者出现某种错误.

希望有所帮助!