Welcome!

ColdFusion Authors: Maureen O'Gara, Hovhannes Avoyan, Yakov Fain, Pat Romanski, Liz McMillan

Related Topics: ColdFusion

ColdFusion: Article

The Asynchronous CFML Gateway

A Real-World Example of a Great New Technology

Although the onIncomingMessage function within the CFC doesn't return anything, the SendGatewayMessage() function returns a boolean. The gateway itself is limited in providing feedback because of its asynchronous nature, so the status boolean that is returned is really an indication of whether or not the call to the gateway was successful; it does not indicate whether or not the gateway's process itself was successful. The success or failure of the process inside the gateway itself must be retrieved using one of the methods previously outlined.

Now here's where the asynchronous magic happens. Once you call SendGatewayMessage(), processing within your application doesn't stop and wait for a response. The application immediately proceeds past that point in the code, and no matter how lengthy the gateway process is, your application is free to proceed. For lengthy processes that would previously hang up your application this is just what the doctor ordered!

Conclusion
Event gateways open ColdFusion applications up to a whole new world of possibilities. The asynchronous CFML gateway is simple, elegant, tremendously powerful, and surprisingly simple to use. If you have long-running processes in your ColdFusion applications or want to add functionality to your application that you were afraid to attempt before due to potential issues with the traditional request/response model, fear no longer. Write a CFC to handle the processing, register it in the ColdFusion administrator, and take advantage of the power of asynchronous processing.

Resources
Corfield, Sean (2005, April 16). "Asynchronous CFML - Concurrency Library." http://corfield.org/blog/index.cfm?do=blog.entry&entry=4D121277-A559-411...

Corfield, Sean (2005, April 14). "Debugging and Caching in Event Gateways." http://corfield.org/blog/index.cfm?do=blog.entry&entry=3F160E0C-B987-C46...

Forta, Ben (2005, March 16). "Understanding Asynchronous Processing." http://www.forta.com/blog/index.cfm?mode=e&entry=1541

Jordahl, Tom (2005, March 16). "Taking Advantage of ColdFusion MX 7 Event Gateways." Recorded Macrochat. http://www.macromedia.com/devnet/mx/coldfusion/articles/gateway_macrocha...

More Stories By Matthew Woodward

Matt Woodward is Principal Information Technology Specialist with the Office of the Sergeant at Arms at the United States Senate. He was until recently a Web application developer for i2 Technologies in Dallas, Texas. A Macromedia Certified ColdFusion Developer and a member of Team Macromedia, he has been using ColdFusion since 1996. In addition to his ColdFusion work, Matt also develops in Java and PHP.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.