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
The 21st International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 21st International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. @ThingsExpo Silicon Valley Call for Papers is now open.
As cloud adoption continues to transform business, today's global enterprises are challenged with managing a growing amount of information living outside of the data center. The rapid adoption of IoT and increasingly mobile workforce are exacerbating the problem. Ensuring secure data sharing and efficient backup poses capacity and bandwidth considerations as well as policy and regulatory compliance issues.
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Five years ago development was seen as a dead-end career, now it’s anything but – with an explosion in mobile and IoT initiatives increasing the demand for skilled engineers. But apart from having a ready supply of great coders, what constitutes true ‘DevOps Royalty’? It’ll be the ability to craft resilient architectures, supportability, security everywhere across the software lifecycle. In his keynote at @DevOpsSummit at 20th Cloud Expo, Jeffrey Scheaffer, GM and SVP, Continuous Delivery Busine...
SYS-CON Events announced today that Outscale will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Outscale's technology makes an automated and adaptable Cloud available to businesses, supporting them in the most complex IT projects while controlling their operational aspects. You boost your IT infrastructure's reactivity, with request responses that only take a few seconds.
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
SYS-CON Events announced today that DivvyCloud will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. DivvyCloud software enables organizations to achieve their cloud computing goals by simplifying and automating security, compliance and cost optimization of public and private cloud infrastructure. Using DivvyCloud, customers can leverage programmatic Bots to identify and remediate common cloud problems in rea...
SYS-CON Events announced today that Tintri, Inc, a leading provider of enterprise cloud infrastructure, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Tintri offers an enterprise cloud platform built with public cloud-like web services and RESTful APIs. Organizations use Tintri all-flash storage with scale-out and automation as a foundation for their own clouds – to build agile development environments...
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs ofte...
SYS-CON Events announced today that Tappest will exhibit MooseFS at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. MooseFS is a breakthrough concept in the storage industry. It allows you to secure stored data with either duplication or erasure coding using any server. The newest – 4.0 version of the software enables users to maintain the redundancy level with even 50% less hard drive space required. The software func...
SYS-CON Events announced today that Interoute has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Interoute is the owner operator of Europe's largest network and a global cloud services platform, which encompasses over 70,000 km of lit fiber, 15 data centers, 17 virtual data centers and 33 colocation centers, with connections to 195 additional partner data centers. Our full-service Unifie...
SYS-CON Events announced today that EARP will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. "We are a software house, so we perfectly understand challenges that other software houses face in their projects. We can augment a team, that will work with the same standards and processes as our partners' internal teams. Our teams will deliver the same quality within the required time and budget just as our partn...
SYS-CON Events announced today that Carbonite will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Carbonite protects your entire IT footprint with the right level of protection for each workload, ensuring lower costs and dependable solutions with DoubleTake and Evault.
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in compute, storage and networking technologies, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/...
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
SYS-CON Events announced today that Progress, a global leader in application development, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Enterprises today are rapidly adopting the cloud, while continuing to retain business-critical/sensitive data inside the firewall. This is creating two separate data silos – one inside the firewall and the other outside the firewall. Cloud ISVs oft...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
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 will examine how DevOps helps to meet th...