Welcome!

You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: ColdFusion

ColdFusion: Article

Part 1: Gateways to Fun

Here We Are Again!

The new release of ColdFusion has some interesting new Java features that just beg for a return and so here we are again! As with the previous series, I'll take the time to cover the basics of these new features before I dig a bit deeper.

Event Gateways
Undoubtedly one of the coolest new Java features in ColdFusion MX 7 is event gateways - opening up a whole new set of possibilities that were, at best, difficult, and at worst, impossible, with previous versions of ColdFusion. Providing a ColdFusion-friendlier means for working with new network protocols to more mundane things like interacting with operating system services, gateways will allow you to expand your Web applications in directions that were previously inaccessible.

The product team did an amazing job of providing a number of samples that really demonstrate the capabilities of this new feature. Add to that the really excellent Macromedia Developer Center article, some exciting postings in various blogs and some advanced articles waiting in the wings for CFDJ - all in all, there's definitely more than a little material available.

So what's the goal with this series? To provide easy-to-consume walkthroughs and tutorials for doing simple things like working with the gateway pages in the ColdFusion Administrator; and to provide a solid ground about the nuts and bolts of writing gateways.

The Basics
An event gateway is just a Java class that acts like a service to extend the ColdFusion Server. It differs from things like CFX tags in that they are threaded and can provide asynchronous communication with a ColdFusion application.

A template can call a CFX tag but that template will hang around until it is done processing before continuing to the next tag in the template. The expectation is that the CFX will perform some immediate task and return. It's possible to write a multithreaded CFX tag but there is no framework for having those subordinate threads report back once the main body of the CFX has returned control to the calling template. Event gateways solve this problem.

Event Gateway Administrator Pages
More than merely allowing you to configure things, the ColdFusion Administrator's Event Gateway pages can tell you a great deal about this new facility. As I cover the configuration pages I will introduce you to bits of gateway jargon that will be useful later when we start building applications that use gateways (for a complete list of the jargon check the product documentation; Developing ColdFusion MX Applications, Using Event Gateways, Event gateway terms and concepts).

Settings
The Event Gateways Settings page (see Figure 1) offers up a few minor, but important options, though in the Developer Edition of the product most of these settings are locked. The first is a check box for enabling gateways, which is checked by default. The second and third settings, processing threads and the size of the event queue respectively, will allow you to fine-tune gateway performance. The Developer Edition has these locked at 10 threads and 25000 events, which is quite generous for basic development.

[Note: Also on this page is a button to start the built-in SMS test server. You can use this sample SMS gateway and client simulator to explore more. I'm not going to cover it in this article as it is already discussed in some detail in the product documentation.

Gateway Types
The Event Gateways Gateway Types page (see Figure 2) provides a way for you to identify gateway classes to the ColdFusion Server, thus creating a type. There are four editable fields and a check box on this page for creating a gateway type and a list of the presently configured gateway types.

The first field, Type Name, is the name you will give the type (this is the gateway type in the jargon). There are no specific requirements, such as matching the name of the Java class or such, only something that is unique and at best meaningful to the purpose of the gateway.

The Description field provides an opportunity to input some textual content for providing more explanatory information about a gateway. The field has a limitation of 550 characters - so try to keep it simple.

The Java Class field is where you enter the name of the gateway's Java class, complete with package. This field is not so frugal as the Type Name or the Description, though if you've a class name in excess of 550 characters you might consider some package reordering and less verbose naming standards. The Java class must indicate a class that is already present in the ColdFusion Server's classpath or else it will fail when you try to add the new gateway type. Since adding jars to the Server's classpath requires a restart you will want to verify this prior to adding new gateway types. New jars can be added in the ColdFusion Class Path field on the Java and JVM page in the Server Settings section of the Administrator.

The Startup Timeout field indicates the number of seconds that the Server will allow during the startup of an event gateway before it kills it; by default this is 30 seconds. This seems a bit excessive since most system operations occur in milliseconds - and even long operations in the thousands of milliseconds fall well below this threshold.

Out of the box the Developer Edition has seven gateway types configured (shown in Figure 2 above). These default gateways provide a number of very useful facilities that satisfy many of the both basic and things-in-vogue services.

Gateway Instances
The Event Gateways Gateway Instances page (see Figure 3) allows you to create instances of a specific gateway type (a gateway instance in the jargon). This page provides three edit fields and two dropdown lists for configuring an instance and a list of the configured gateway instances.

The Gateway ID field allows you to specify a label name for a particular instance. This is the name (or gateway ID in the jargon) that will be used to programmatically reference the event gateway for sending messages. It does not have any specific requirements, though it should be unique and meaningful. The form field displayed in the browser has a limit of 550 characters which ought to be plenty even for host providers that might like to prefix a specific gateway instance name with a domain name or a corporate server prefixing with a department name.

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.

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.


@ThingsExpo Stories
Elon Musk is among the notable industry figures who worries about the power of AI to destroy rather than help society. Mark Zuckerberg, on the other hand, embraces all that is going on. AI is most powerful when deployed across the vast networks being built for Internets of Things in the manufacturing, transportation and logistics, retail, healthcare, government and other sectors. Is AI transforming IoT for the good or the bad? Do we need to worry about its potential destructive power? Or will we...
SYS-CON Events announced today that SIGMA Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. uLaser flow inspection device from the Japanese top share to Global Standard! Then, make the best use of data to flip to next page. For more information, visit http://www.sigma-k.co.jp/en/.
SYS-CON Events announced today that Daiya Industry will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Daiya Industry specializes in orthotic support systems and assistive devices with pneumatic artificial muscles in order to contribute to an extended healthy life expectancy. For more information, please visit https://www.daiyak...
SYS-CON Events announced today that B2Cloud will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. B2Cloud specializes in IoT devices for preventive and predictive maintenance in any kind of equipment retrieving data like Energy consumption, working time, temperature, humidity, pressure, etc.
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp em...
SYS-CON Events announced today that Interface Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Interface Corporation is a company developing, manufacturing and marketing high quality and wide variety of industrial computers and interface modules such as PCIs and PCI express. For more information, visit http://www.i...
SYS-CON Events announced today that Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...
SYS-CON Events announced today that Nihon Micron will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Nihon Micron Co., Ltd. strives for technological innovation to establish high-density, high-precision processing technology for providing printed circuit board and metal mount RFID tags used for communication devices. For more inf...
SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
SYS-CON Events announced today that Suzuki Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Suzuki Inc. is a semiconductor-related business, including sales of consuming parts, parts repair, and maintenance for semiconductor manufacturing machines, etc. It is also a health care business providing experimental research for...
While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, will discuss how data centers of the future will be managed, how th...
SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that mruby Forum will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. mruby is the lightweight implementation of the Ruby language. We introduce mruby and the mruby IoT framework that enhances development productivity. For more information, visit http://forum.mruby.org/.
SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
In his session at @ThingsExpo, Greg Gorman is the Director, IoT Developer Ecosystem, Watson IoT, will provide a short tutorial on Node-RED, a Node.js-based programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes in the palette that can be deployed to its runtime in a single-click. There is a large library of contributed nodes that help so...
SYS-CON Events announced today that Enroute Lab will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enroute Lab is an industrial design, research and development company of unmanned robotic vehicle system. For more information, please visit http://elab.co.jp/.
Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are now increasingly adopting Agile practices across their organizations in order to successfully navigate the disruptive waters that threaten to drown them. In our quest for establishing change as a core competency in our organizations, this business-centric notion of Agile is an essential component of Agile Digital Transformation. In the years since the publication of the Agile Manifesto, the conn...
Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...