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
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
Consumers increasingly expect their electronic "things" to be connected to smart phones, tablets and the Internet. When that thing happens to be a medical device, the risks and benefits of connectivity must be carefully weighed. Once the decision is made that connecting the device is beneficial, medical device manufacturers must design their products to maintain patient safety and prevent compromised personal health information in the face of cybersecurity threats. In his session at @ThingsExpo...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that Massive Networks 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. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that Grape Up 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. Grape Up is a software company specializing in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the U.S. and Europe, Grape Up works with a variety of customers from emergi...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, will examine the regulations and provide insight on how it affects technology, challenges the established rules and will usher in new levels of diligence a...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
In the enterprise today, connected IoT devices are everywhere – both inside and outside corporate environments. The need to identify, manage, control and secure a quickly growing web of connections and outside devices is making the already challenging task of security even more important, and onerous. In his session at @ThingsExpo, Rich Boyer, CISO and Chief Architect for Security at NTT i3, discussed new ways of thinking and the approaches needed to address the emerging challenges of security i...
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...
There is only one world-class Cloud event on earth, and that is Cloud Expo – which returns to Silicon Valley for the 21st Cloud Expo at the Santa Clara Convention Center, October 31 - November 2, 2017. Every Global 2000 enterprise in the world is now integrating cloud computing in some form into its IT development and operations. Midsize and small businesses are also migrating to the cloud in increasing numbers. Companies are each developing their unique mix of cloud technologies and service...
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 Datera, that offers a radically new data management architecture, 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. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
SYS-CON Events announced today that Akvelon 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. Akvelon is a business and technology consulting firm that specializes in applying cutting-edge technology to problems in fields as diverse as mobile technology, sports technology, finance, and healthcare.
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a...