通过 CFC 与 cfthread 进行异步事件?
我不敢相信我刚刚读了这个: 使用 CFML 事件网关对于异步 CFC
据我所知,线程也可以用来做异步事件。但是,我无法理解何时应该使用线程还是 CFML 事件网关?什么目的或情况适合一种实现而不是另一种实现?
ColdFusion 标准版中的 CFC 对异步事件有任何限制吗?我知道 cfthread 的最大自定义线程数有限制。 “事件网关处理线程”是否有任何限制?
I can't believe I just read this: Using the CFML event gateway for asynchronous CFCs
As far as I know a thread can also be used to do async events. However, I am having trouble understanding when I should use a thread vs. a CFML event gateway? What purpose or situation lends itself to one implementation verses the other?
Any limitation to asynchronous events through CFCs in ColdFusion Standard Edition? I know there's a cfthread limitation of 2 max custom threads. Does "Event Gateway Processing Threads" count towards any limit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对异步事件使用事件网关早于线程,我认为“异步 cfc”功能是一个额外的副作用。
如果目标只是分拆一些要异步完成的处理,我会使用线程。
事件网关的真正目的是与外部系统进行通信。我广泛使用了事件网关,但用于与消息队列、XMPP、流式 Twitter API 以及许多其他晦涩的“企业 java-y”事物进行通信。
事件网关的问题之一是它们运行的环境与通过 http 服务器发送的请求略有不同。例如,大多数 CGI 变量未设置或包含异常值。您也无权访问用户的会话等。
使用 CFTHREAD,您对此拥有更多控制权。
在此处查看产品矩阵:
http://www.adobe.com/products/ Coldfusion/pdfs/cf9_feature_comparison_matrix_ue.pdf
看来,在 CF 标准中,您会获得一个同时事件网关,因此它在生产环境中可能不是一个有用的功能。我认为它硬锁定到单个线程,无论管理员设置什么。
所以,有了CF Standard,你就有点完蛋了。
这也是使用 Railo 或 OpenBD 的另一个原因。
Using event gateways for Asynch events pre-dates threads, and I think the "asynch cfc" feature was a bonus side effect.
If the goal is simply to spin off some processing to be completed asynchronously, I would use threads.
The real point of Event Gateways is to communicate with externals systems. I've used event gateways extensively, but to communicate with message queues, XMPP, the streaming Twitter API, and a number of other obscure "enterprise java-y" things.
One of the problems with Event Gateways, is that the environment they run in is subtly different from a request sent through an http server. For instance, most of the CGI variables are unset or contain unusual values. You also don't have access to the user's session, etc.
With CFTHREAD, you have a lot more control about that.
Looking at the product matrix here:
http://www.adobe.com/products/coldfusion/pdfs/cf9_feature_comparison_matrix_ue.pdf
It appears that in CF Standard, you get one simultaneous event gateway, so its probably not a useful feature in a production environment. I think its hard-locked to a single thread, regardless of what is set in the administrator.
So, with CF Standard, you're kinda screwed.
Just another reason to use Railo or OpenBD.