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
Amazon started as an online bookseller 20 years ago. Since then, it has evolved into a technology juggernaut that has disrupted multiple markets and industries and touches many aspects of our lives. It is a relentless technology and business model innovator driving disruption throughout numerous ecosystems. Amazon’s AWS revenues alone are approaching $16B a year making it one of the largest IT companies in the world. With dominant offerings in Cloud, IoT, eCommerce, Big Data, AI, Digital Assista...
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists looked at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deliver...
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), provided an overview of various initiatives to certify the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldwide re...
With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, discussed some of the security challenges of the IoT infrastructure and related how these aspects impact Smart Living. The material was delivered interac...
IoT solutions exploit operational data generated by Internet-connected smart “things” for the purpose of gaining operational insight and producing “better outcomes” (for example, create new business models, eliminate unscheduled maintenance, etc.). The explosive proliferation of IoT solutions will result in an exponential growth in the volume of IoT data, precipitating significant Information Governance issues: who owns the IoT data, what are the rights/duties of IoT solutions adopters towards t...
"When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
The Internet giants are fully embracing AI. All the services they offer to their customers are aimed at drawing a map of the world with the data they get. The AIs from these companies are used to build disruptive approaches that cannot be used by established enterprises, which are threatened by these disruptions. However, most leaders underestimate the effect this will have on their businesses. In his session at 21st Cloud Expo, Rene Buest, Director Market Research & Technology Evangelism at Ara...
No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists examined how DevOps helps to meet the de...
When growing capacity and power in the data center, the architectural trade-offs between server scale-up vs. scale-out continue to be debated. Both approaches are valid: scale-out adds multiple, smaller servers running in a distributed computing model, while scale-up adds fewer, more powerful servers that are capable of running larger workloads. It’s worth noting that there are additional, unique advantages that scale-up architectures offer. One big advantage is large memory and compute capacity...
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.
Artificial intelligence, machine learning, neural networks. We’re in the midst of a wave of excitement around AI such as hasn’t been seen for a few decades. But those previous periods of inflated expectations led to troughs of disappointment. Will this time be different? Most likely. Applications of AI such as predictive analytics are already decreasing costs and improving reliability of industrial machinery. Furthermore, the funding and research going into AI now comes from a wide range of com...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, 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 Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized 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 acr...
SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
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.