Tuesday, March 22, 2011

Desktop Events with OpenSpan and Oracle CEP - Part 3

Having started the Oracle CEP successfully was the goal for the second part of this tutorial. Now, we're going to start building a sample OpenSpan automation to send messages through the JMS interface we created previously and push events from the desktop application to Oracle CEP.

28. Go to OpenSpan Studio (or MS-Visual Studio with OpenSpan plug-in installed) and create a new project. Select OpenSpan Project and name it OpenSpan_OCEP_Tutorial

29. Add a new Windows Form. Add a label, text box and button to your recently created Windows Form. You should have something similar to the following picture:

30. Go to Automation1 (Add a new Automation if you don't have one) and drag a MessagePublisher component from the Toolbox (Add the component to the Toolbox if it's not available for you). Make sure it's set to Global.
31. Highlight the messagePublisher1 component and go to the Properties panel. Select the MessageVendorType and set the Message Connection Properties to connect to the Oracle WebLogic instance we configured on the Part 1 of this tutorial.

You have to provide the following information:

Host: localhost
Port: 7001
Connection Factory Name: osevents_queue_cf
Queue Name: osevents_SampleQ1
Queue Type: Queue
Username: (your username to Oracle WebLogic)
Password: (your password to Oracle WebLogic)
Make sure you update the connection information to Oracle WebLogic if you haven't followed the tutorial and changed that information along the course of it.

32. Let's initialize the messageProducer1 component when we start the project. To do that, add an OpenSpan.Runtime.RuntimeHost/ProjectStarted Event component from the Toolbox.

33. Next, add the messagePublisher1 (Start Method) to the Automation1 and then connect OpenSpan.Runtime.RuntimeHost/ProjectStarted to the messagePublisher1. You should end up with something similar to the following:

34. Add the submit button click event, the text box value and messageProducer1 (Send Method) to the Automation1 canvas. Create the message workflow connecting submit button click to the message producer. Set the text of the message connecting the text box value to the msgText variable on the message producer. Your automation should look like this:

35. Run the project, type something on the text box of the Windows form and click Publish.

36. When you click Publish on the Windows form , a JMS message is dispatched from the OpenSpan Runtime to the Oracle WebLogic JMS provider, that message is stored on the osevents_SampleQ1 queue until it's consumed by the listener on the Oracle CEP project configured on Part 2 of this tutorial. The message content is then displayed on the Oracle CEP console.

37. That message is displayed on the Oracle CEP Console because the query running against the events is simply selecting all events sent to the helloInputChannel.

The HelloWorldBean then gets the text of the message's body and print it.

Feel free to modify the query running against the events published to this Oracle CEP project or the bean printing the messages to experiment different behaviors.

This concludes the Desktop Events with OpenSpan and Oracle CEP. I hope you could follow along and this tutorial could give you a good start point to work with OpenSpan and CEP engines. Please don't hesitate to contact me if you have any questions or comments.

UPDATE: The source code of this project is available at http://dl.dropbox.com/u/10511857/OCEP_OpenSpan_Tutorial.zip

Setting Up Local Environment for Developing Oracle Intelligent Bots Custom Components

Oh the joy of having a local development environment is priceless. For most cloud based solutions the story repeats itself being hard to tr...