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

Brainstorming with Nimer: ColdFusion Gateways

What are these things and what can I do with them - including SMS phone applications, IM bots, and Oracle triggers.

With the announcement of ColdFusion MX 7 in February, we introduced event gateways that turn the ColdFusion web application server into a bona fide Internet application server. The gateways are a great new feature for developers. You can now build applications for a variety of protocols and devices, not just HTTP. Because it's ColdFusion, we made it easy to develop and deploy outside the browser, and you can let your imagination run wild.

But why, you may ask, didn't we have these to begin with? Ten years ago, when ColdFusion was first introduced, the Internet consisted of only a few network protocols including HTTP, ftp, and gopher. At the time, the idea of creating a server that focused specifically on one protocol, HTTP, made sense. Today there are dozens and dozens of protocols using the Internet: SMPP, XMPP, P2P, RMI, JMS, RTMP, just to name a few. ColdFusion MX 7 has now opened these protocols to the masses, making development for them as easy as development for http.

Let's do some brainstorming and think about some ways you can use these new gateways. To keep things simple, we'll just focus on the gateways we ship out of the box.

1.  Asynchronous CFML Gateway
Logging

If you want to start keeping detailed logs about your site and your users' activities, the asynchronous CFML gateway is the way to go. You could do this in the past, but if you got too verbose and started logging too much, you could slow a page down with lots of file writes or database inserts.

Now you can create a logging CFC that will do the file writes and the database inserts. Instead of calling the CFC in your page and slowing your page down, you can send a quick message to the CFML gateway and continue processing your page with no performance hit. The CFML gateway will then take the time to wait behind other requests to call the logging CFC and to log the message

Caching
Let's say you have a page you run every night that loops over a list of URL's using cfhttp to call each URL and writes the results to an HTML file for you to serve up on your site later. Now, instead of this taking a few hours while CF calls the first URL, waits for a reply, writes the file, calls the second URL, and so on for each URL. You can quickly loop over each URL and send the URL to the CFML gateway, which will forward it on to your caching.cfc. The CFML gateway will then queue up all URL requests and run them in multiple threads simultaneously. What used to take hours might now only take a few minutes.

2.  Directory Watcher
File Indexing

Imagine you have a site where users can upload documents that you will want available for searching on the site. For instance, this could be resumes for your HR department. Currently you would upload the file and then invoke the cfindex tag to index the new file and update the collection. This works, but the user has to wait for the file to upload and for you to index the file for your site. They don't want to wait for that.

With the directory watcher you just upload the file and move on. The gateway will automatically pick up the new file and send it to your index_file.cfc, which will run the cfindex tag and update the collection.

Build Process Alerts
One application built with the directory watcher for the ColdFusion team is a file watcher for build alerts. Whenever a new check-in is made in the ColdFusion code base, we automatically rebuild the installers. When the file watcher notices that a new installer file exists, it will send out an e-mail to the engineering and QA teams alerting them to the fact that a new build is available and ready to test.

3.  Socket Gateway
Server Administration

Have you ever wanted to just Telnet into a remote ColdFusion server and turn debugging on or off, add a custom tag path, run a scheduled task, add or build a verity collection, or reset log files? With the socket gateway you can build a Telnet interface into ColdFusion allowing a CFC to respond to the telnet session. Any cfml code you write can now be accessed through a Telnet or command window instead of a web page.

4.  JMS Gateway
Oracle Triggers

In the past ColdFusion interaction with the database has always been a pull relationship. ColdFusion has to ask the database for data, ask for updates, and ask for changes. This is fine if the same application that updates the database is the same one that checks for changes. However, what if you have multiple apps that update the database? How can one application know if the data has changed without causing a lot of unnecessary database traffic?

Oracle ships with an embedded JVM, which means that you can invoke Java calls with a database trigger. All you need to do is connect Oracle to a JMS provider (one ships with JRun) and write some Oracle triggers that send JMS Messages whenever a database value changes.

Now you can also use the JMS gateway in ColdFusion to listen for new messages. When the data changes, ColdFusion can act accordingly. These actions can include: send an e-mail, send an SMS, update an IM status with new totals from the database, or update an application variable. The best part with JMS is you can have multiple applications all registered as listeners for the same Oracle trigger messages.

ERP/CRM Systems
A number of different ERP/CRM companies use JMS providers under the covers to send and receive messages between the different portions of the application. With the ColdFusion JMS gateway, you add ColdFusion to the suite of tools that are used with the ERP/CRM system.

5.  XMPP/SAMETIME IM Gateways
Help Desk

This is where it gets fun as we can begin to build IM bots. You can create a "help desk" buddy on Jabber and, with the XMPP/SAMETIME IM gateway, register each of your IT and help desk technicians as approved buddies to the "help desk" buddy. Then you register the "help desk" buddy with every employee in your company.

When a user has a question for the help desk, they can just ask their "help desk" buddy and CF (the actual "help desk" buddy) will check its list of buddies (the help desk staff) and forward the request to the next online help desk technician. At the same time, it can automatically create a help desk ticket used to track the request or problem that you are asking them about.

Web Site Chat with the Help Desk
Along the same lines as the help desk idea, you can use the XIFF ActionScript library that's available online to write a chat window on your website. This Flash chat window would be hardwired to use the ColdFusion XMPP buddy, which can track the conversation and manage the routing of the held desk request to the right help desk technician.

Time Tracker
Members of your teams may need to track their hours. Instead of using an online time sheet or some scratch paper on their desk, teams can use the "time tracker buddy" and just send it a start or end message with a note.


Xyz project: start: phone call with client
(10 minutes later)
Xyz project: task: Remember to ask the supplier about new pricing.
(20 minutes later) 
Xyz project: end: phone call, talked about lots of new ideas.

Abc project: start: designing logo
(5 hours later)
Abc project: end:

ColdFusion will automatically receive these messages, parse out the project name, action, and message, and enter the data into your database. This allows you to use the online time tracker application that you've already built to run a few reports and generate the weekly reports and invoices.

Expense Approval
Say you have an expense approval system, in which a user submits an expense report and it needs to be approved by their manager. You could write a ColdFusion application that can detect if the manager is online or not. If the manager is online when the user submits an expense report, an IM can be sent to the manager asking him to approve the expense report. The manager responds with a quick IM message of approval, the system registers the approval, and then sends on the expense report to the finance department. If the manager is not online, the system will just send an e-mail instead.

Bug Alerts
With the IM gateway, you can start alerting yourself to a number of smaller alerts that you need to know about but which don't need to be kept around for permanent storage in your inbox. Using the IM gateway, you can set it up so that every time a new bug is sent to your bug queue a quick IM message can be sent off. You'll then know that you have a new bug. This provides you with immediate feedback while at the same time keeping the extra clutter out of your inbox.

Status Indicator
IM clients have a cool feature: the status indicator. With many applications there is only certain data that you care about, which might include the most recent value of stock prices, highest bid in an auction, and sales figures for the month. With a simple ColdFusion application you can have ColdFusion update the stock quote buddy status with the latest stock quote or the action buddy with the current highest bid of the auction you are monitoring. All of this without sending a new e-mail every time the value changes. This now allows you to check the value just by looking at your IM client, not when the server wants to update you.

6.  SMS Gateway
Phone Directory:

The phone directory on the home page of your intranet is a great thing if you are sitting at your desk with your computer running and a browser open. Of course the time you need to really call someone is when you're not at your desk. It's when you are driving to work, stuck at the airport, or at home with no Internet connection. With a simple SMS phone directory application, you can send a text message with the name of the person you want to look up and seconds later ColdFusion will send back to you the name, office, and phone number of the person you need to talk to. Some phones even detect phone numbers in a message and allow you to select and call the person directly from the text message screen.

Flight Status
Lots of applications can send a change of status e-mail or even a text message, but with ColdFusion on the back-end of the SMS message, you can now send an alert and ask for a response. For instance, if a plane is canceled, a text message could be sent with a notice and a request for what to do: cancel flight, call customer server, or re-book on flight A or flight B.

Expense Approval
Similar to the IM example above, instead of only sending approval requests when the manager is at their desk, it can send a SMS to the manager regardless of where they are whether it be at home, the airport, or in their car.

Meeting Attendance
How many times have you scheduled a meeting with someone, only to have them get pulled away right before or miss their meeting reminder and pull a no-show? With the SMS gateway you could automatically send a confirmation message to the other attendees reminding and asking them if they will still make it to the meeting. "You have a meeting in 15 minutes with John, will you be able to make it or should we reschedule?" Depending on the answer, you may be able to skip a meeting!

Build Broken Alerts
We have a rule on the ColdFusion team: if you check-in new code and it breaks the build, you need to stay and fix it. As much as we try to prevent it, people will check-in, shut down their computers, and leave before waiting to see if they got a broken build notice sent to their email inbox.

Now you can set up your build machine to send a SMS text message to the person who broke the build instead of an e-mail. This way even if they are in the parking garage or driving home, they will get the notice and know they need to turn around and fix the build.

Server Monitor Alerts
There are lots of server monitoring tools out there. All of them can send you an e-mail if they detect a problem or even page you. But do you still carry a pager? What if the tool could send you a SMS text message asking you what to do: page someone, ignore, or reboot the server.

A problem has been detected with Server A. What would you like to do?
1 - Page Sys-Admin
2 - Ignore
3 - Reboot Server A

This silent text message allows you to fix the problem without interrupting dinner or the movie or game you are watching!

Website Authentication Via Phone
A common application already used by a few websites is User Authentication via the phone for website registration. A user registers for a new account with your website. Instead of sending an e-mail to confirm the registration was for the right person, you can have ColdFusion send the user an SMS text message asking them to reply to the message from their phone to confirm their identity.

Banking
SMS is an end-to-end secure protocol, authenticated against the SIM card in your phone. It is already used by banks around the world to notify users of bank balances changes or to allow them to perform online banking from their phone: transfer funds, check balances, pay bills, and so on. You can now expose secure financial data straight to a user's phone anywhere in the world.

On Call Alerts
Right now when companies need to find an on-call employee immediately - such as when a hospital needs to find a doctor - someone has to start making phone calls. With a simple on-call application, you can send a message to all of the on-call doctors with a short description of the problem and request for confirmation. As soon as the first doctor responds that they are on the way, the application can register the doctor with the emergency and send another alert to the other doctors canceling the request.

Some of the ideas I've mention above may seem complicated - SMS phone applications, IM bots, and Oracle triggers. But thanks to ColdFusion, the hard stuff is made easy, so many of these might only take a few minutes or some just an hour or two. I've only scratched the surface of what is possible. But hopefully I have your mind racing with new application ideas that are now made possible with the use of the ColdFusion MX 7 event gateway features!

More Stories By Mike Nimer

Mike Nimer is a senior engineer on the ColdFusion engineering team, responsible for features such as the Rich Forms in ColdFusion 7 and the Administrator API. Before joining the engineering team, he spent three years working as a senior consultant with Allaire and then Macromedia consulting group, providing on-site assistance to customers with their architecture planning, code reviews, performance tuning, and general fire fighting.

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
SYS-CON Events announced today that Dasher Technologies 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. Dasher Technologies, Inc. ® is a premier IT solution provider that delivers expert technical resources along with trusted account executives to architect and deliver complete IT solutions and services to help our clients execute their goals, plans and objectives. Since 1999, we'v...
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 emp...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, 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. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, will lead you through the exciting evolution of the cloud. He'll look at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering ...
In a recent survey, Sumo Logic surveyed 1,500 customers who employ cloud services such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). According to the survey, a quarter of the respondents have already deployed Docker containers and nearly as many (23 percent) are employing the AWS Lambda serverless computing framework. It’s clear: serverless is here to stay. The adoption does come with some needed changes, within both application development and operations. Tha...
SYS-CON Events announced today that Avere Systems, a leading provider of enterprise storage for the hybrid cloud, 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. Avere delivers a more modern architectural approach to storage that doesn't require the overprovisioning of storage capacity to achieve performance, overspending on expensive storage media for inactive data or the overbui...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
SYS-CON Events announced today that TidalScale 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. TidalScale is the leading provider of Software-Defined Servers that bring flexibility to modern data centers by right-sizing servers on the fly to fit any data set or workload. TidalScale’s award-winning inverse hypervisor technology combines multiple commodity servers (including their ass...
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...
As hybrid cloud becomes the de-facto standard mode of operation for most enterprises, new challenges arise on how to efficiently and economically share data across environments. In his session at 21st Cloud Expo, Dr. Allon Cohen, VP of Product at Elastifile, will explore new techniques and best practices that help enterprise IT benefit from the advantages of hybrid cloud environments by enabling data availability for both legacy enterprise and cloud-native mission critical applications. By rev...
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant th...
Digital transformation is changing the face of business. The IDC predicts that enterprises will commit to a massive new scale of digital transformation, to stake out leadership positions in the "digital transformation economy." Accordingly, attendees at the upcoming Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA, Oct 31-Nov 2, will find fresh new content in a new track called Enterprise Cloud & Digital Transformation.
Most technology leaders, contemporary and from the hardware era, are reshaping their businesses to do software. They hope to capture value from emerging technologies such as IoT, SDN, and AI. Ultimately, irrespective of the vertical, it is about deriving value from independent software applications participating in an ecosystem as one comprehensive solution. In his session at @ThingsExpo, Kausik Sridhar, founder and CTO of Pulzze Systems, will discuss how given the magnitude of today's applicati...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
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:...