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?
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.
精彩评论