An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Blackstone Event Gateway

June 29, 2004 ·

I said I'd talk a bit more about this feature - demo'd for the first time as an exclusive for CFUN - and I can now describe what we're using it for internally. A while back, I talked about how we are using ColdFusion to implement the 'glue' between our various sales channels and our new ERP system (Oracle Applications). I didn't go into much detail at the time but we decided, as part of the new system implementation, to switch over from a variety of legacy file formats to a standard OAGIS XML format for all incoming sales orders, all outgoing 'pick releases' (that tell fulfillment houses to ship products) and all incoming shipped goods confirmations.
I implemented the XML processing code as a Mach II application and it runs as a set of scheduled tasks, fetching XML files from an internal FTP server, parsing and loading the sales orders / ship confirms into Oracle, scanning Oracle for new pick releases and generating and posting those XML files. Most of existing feeds are implemented in batch mode for historical reasons - on certain schedules, various systems place new orders on the FTP server for processing. Naturally, there is some latency between a customer placing the order and it being recorded in our system.
We're in the process of switching some of our channels over to real-time messaging using our enterprise message hub, which is a JMS server cluster. With Blackstone, we are able to handle this on the back end using the new event gateway...
I wrote three small Java classes, totalling about 170 lines including comments, and a single CFC. The Java classes are as follows:
  • JMSConfiguration - encapsulate a four-line properties file that specifies the hub server, topic and two other JMS startup parameters - 45 lines
  • JMSConsumer - a lightweight consumer class, mostly copied from the JRun docs JMS example - 75 lines
  • JMSGateway - an implementation of the Blackstone gateway that constructs and manages the JMSConsumer object - 50 lines
I didn't really need the JMSConfiguration class - it was just present for elegancy - so I could have gotten away with writing only 50 lines of Java (and doing copy'n'paste to get almost the other 75). The CFC was also very simple, taking the message passed by the gateway (a string containing the XML payload) and passing it to the existing CFC that we already used for parsing and loading sales order XML files.
Then it was a simple matter of placing the JAR file containing the classes in the CFMX library directory and configuring the gateway through the CF Admin: create a new gateway type (JMS) using the main class in the JAR file, define a specific gateway of that type (using the CFC and the properties file) and finally start the gateway.
Now we can get sales orders from some channels into our ERP system in (near) real-time, thanks to Blackstone!
I'll probably be building more gateway-based applications and I'll be blogging those as well...

Tags: coldfusion

12 responses

  • 1 Brandon // Sep 8, 2004 at 5:04 PM

    For those of us that didn't attend CFUN, can you write up what this new Event Gateway is?<br /><br />How is it different than JMS? Is it essentially what Message Driven Beans are to JMS?<br /><br />It sounds like it is extensible by an API to tie in heterogenous systems. In the case provided here, you tied in JMS.<br /><br />I want to ask so much more. My thoughts drift to asynchronous processing. As the name implies, Event Gateway, does this feature capture or produce events or both? Will this finally solve my hack? Will there be a URL based interface?<br /><br />Brandon
  • 2 Sean Corfield // Sep 8, 2004 at 5:04 PM

    I don't know how to explain it any better than what I said about the keynote here:<br /><br /><a href=""></a><br /><br />You write a little Java that connects to whatever external system you need and then asynchronous events from that system can be fed to a CFC and processed.<br /><br />You ask "Will there be a URL based interface?" - the whole point of the gateway is to allow CF to support non-HTTP-based requests.
  • 3 Patrck Whittingham // Sep 8, 2004 at 5:04 PM

    Could this event gateway work against Documentum 4i or a Hyperion Essbase database (OLAP) ?<br /><br />- Pat
  • 4 Sean Corfield // Sep 8, 2004 at 5:04 PM

    Pat, if you can write the Java code to accept asynchronous requests / messages from those products then, yes, you could write CFCs to respond to that and use Blackstone's event gateway!
  • 5 Mike Klepper // Sep 8, 2004 at 5:04 PM

    Hi Sean,<br /><br />Can the event gateway be used for writing chat rooms (maybe using Flash on the client side)? If course, I mean doing this in a way other than periodic client pulling.<br /><br />Thanks,<br />Mike
  • 6 Paul Kenney // Sep 8, 2004 at 5:04 PM

    The answer is yes.
  • 7 Brandon // Sep 8, 2004 at 5:04 PM

    When Ben Forta came through a week or so ago to my user group I asked the question whether there would be a simple interface in Blackstone for application lifecycle events. Specifically, onSessionBegin, onSessionEnd, onServerStartup, onServerShutdown, onApplicationBegin, onApplicationEnd, etc...I want code that is guaranteed to run when these events are triggered. With a big grin like a kid that knows something that you don't know Ben said he knew how this could be accomplished and that was that, he wouldn't say more. Clearly reading between the lines I could tell that something bigger was not revealed in the meeting. It was held back for CFUN. Is the Event Gateway how Blackstone will support these application lifecycle events? Or am I off my mark?<br /><br />Brandon
  • 8 Patrick Whittingham // Sep 8, 2004 at 5:04 PM

    Cool Sean, Are you able to show your Java code to give us some ideas?<br /><br /><br />- Pat
  • 9 Ben Forta // Sep 8, 2004 at 5:04 PM

    Brandon, stay tuned, we're not done yet. That is something we still want to do, but I did not want to comment on it until I knew that we'd actually get to it this release. No promises yet, but I agree with you, it is much needed and long overdue.
  • 10 Sean Corfield // Sep 8, 2004 at 5:04 PM

    Pat, no I can't share the code yet - given where we are in the product lifecycle, it will change before release as the functionality gets 'baked'...
  • 11 Peter Tilbrook // Sep 8, 2004 at 5:04 PM

    I was already playing around with the limited gateway features in the existing release (RedSky) after reading the CFDJ article in May!<br /><br />Lots of potential!
  • 12 Sean Corfield // Sep 8, 2004 at 5:04 PM

    Peter, what are you talking about? There is no gateway in CFMX 6.1. What CFDJ article are you on about?