| By Guy Rish | Article Rating: |
|
| August 9, 2005 05:00 PM EDT | Reads: |
14,152 |
The two other members, the sender address and the subject line, are added to the structure. Finally, on line 15, the EmailBlaster gateway instance is invoked with a call to sendGatewayMessage and the message structure is passed.
The Change Up
Clearly there is a problem in making EmailBlaster useful in any capacity if it's only capable of calling to a single listener CFC. It would be imminently more useful if additional data elements could be passed and different e-mail letter content could be used. One way of doing this, which serendipitously helps to demonstrate a cool feature of gateways, is to indicate a different listener CFC in the messageStruct passed to sendGatewayMessage.
The Calling Logic, Part Deux
A few additions to what was our original calling logic will produce Newsletter.cfm (see Listing 3).
Herein there are two additional columns added to the query that is being sent in the messageStruct, firstname, and lastname. Everything else remains more or less the same until line 15 where the structure member cfcPath (which was shown briefly in Table 3) is added, indicating the Newsletter.cfc in the same calling directory (obtained using CFML's expandPath function).
The Listener CFC, Part Deux
The new listener CFC, Newsletter.cfc (see Listing 4), is merely a rehash of the default listener configured in the ColdFusion Administrator for this gateway instance. The one point of change is line 10 where the two new columns added in the calling logic are pasted into the output of the e-mail body.
It should be noted that the sample code for this article requires that you do two things before you can successfully run the examples:
1. Configure your ColdFusion Server's mail server settings
2. Change the e-mail addresses used in the templates to valid values:
- EmailBlaster.cfm, line 7
- EmailBlaster.cfm, line 10
- Newsletter, line 9
- Newsletter, 12
The simple examples in this article demonstrate only the barest minimum of a more complicated system. Now that you have a basic grounding in setting up gateway instances, writing listener CFCs, and passing messages to instances, we can dig a little bit deeper. The next installment in this series will look at integrating gateway instance into applications using ColdFusion's persistent scopes and what some of the impacts upon some popular practices.
Be sure to drop by the CCOJ blog and post your feedback and questions about this article and the series. (Note: Listings 1-4 are also available on the CCOJ blog [http://ccoj.coldfusionjournal.com], ccojas-part2-code.zip.)
Published August 9, 2005 Reads 14,152
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Guy Rish
Guy Rish is a ColdFusion and .NET developer at Vente as well as President at Gestaltech. He is an active developer and writer for various languages and technologies, and has contributed work in books on ColdFusion MX, Flash MX, and Dreamweaver MX. He blogs at ccoj.coldfusionjournal.com.
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- Adobe Fiddles with its Web Apps
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF






















