Showing posts with label cep. Show all posts
Showing posts with label cep. Show all posts

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)
Session Mode: AUTO_ACKNOWLEDGE
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

Monday, March 21, 2011

Desktop Events with OpenSpan and Oracle CEP - Part 2

On the first part of this tutorial we walked through the steps of Oracle WebLogic JMS configuration. This is a very important step since it's the base underlying communication system between the major components for the integration between the applications part of this demonstration.


9. Assuming that everything works fine on the infrastructure side of the project you’re now ready to start developing your Oracle CEP application. Go to Oracle Enterprise Pack for Eclipse (Start Menu > Oracle WebLogic > Oracle Enterprise Pack for Eclipse).

10. Create a new Oracle CEP Application Project. Go to File > New > Other > Oracle CEP > Oracle CEP Application Project.

11. Name the project OpenSpan_Tutorial and leave all other fields as default.

12. Click Next.

13. On the New Oracle CEP Application Project select “Create an Oracle CEP Application using an application template” and choose Hello World as the template.

14. Click Finish.

15. At this point you should have an Oracle EPN similar to this:


16. Right-click at the OpenSpan_Tutorial canvas and select New… Adapter. Name it jmsAdapter.
17. Go to the config.xml file under the META-INF\wlevs\ directory and add the following configuration:


<jms-adapter>
<name>jmsAdapter</name>
<jndi-provider-url>t3://localhost:7001</jndi-provider-url>
<destination-jndi-name>osevents_SampleQ1</destination-jndi-name>
<user>weblogic_username</user>
<password>weblogic_password</password>
<session-transacted>false</session-transacted>
</jms-adapter>


The above configuration tells the Oracle CEP application to connect to the JMS Provider configured under Oracle WebLogic.


18. Go back to the OpenSpan Tutorial EPN and remove the connection between the helloWorldAdapter adapter and the helloworldInputChannel.

19. Add a connection from the jmsAdapter to the helloworldInputChannel.

20. Right-click on the jmsAdapter component and choose Go to Assembly Source. Add the following to the helloworld-context.xml file


<wlevs:adapter id="jmsAdapter" provider="jms-inbound">
<wlevs:listener ref="helloworldInputChannel" />
<wlevs:instance-property name="converterBean" ref="eventAdapter"/>
</wlevs:adapter>


You’ll also need to add the following bean definition:

<bean id="eventAdapter"class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>


21. Go to the HelloWorldBean java class and add the following imports:


import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
import com.bea.wlevs.adapters.jms.api.InboundMessageConverter;
import com.bea.wlevs.adapters.jms.api.MessageConverterException;


22. Change the HelloWorldBean class to implement InboundMessageConverter. To do that, change the class signature to be:


public class HelloWorldBean implements StreamSink, InboundMessageConverter {


23. Then, implement the following required method:


public List convert(Message message) throws MessageConverterException, JMSException {
javax.jms.TextMessage textMessage = (TextMessage) message;
System.out.println("Message Processed: " + textMessage.getText());
return null;
}




24. Save and close all files.

25. Your Oracle EPN should be similar to the following picture:


26. It’s time to deploy your project. Go to the Servers view. Right-click on your Oracle CEP v11.1 instance, click on Add and Remove, select the OpenSpan Tutorial and click on Add. Click Finish.

27. Your project should be deployed successfully and you should see a message similar to this on the Eclipse console:


<Mar 18, 2011 9:43:50 PM EDT> <Notice> <Deployment> <BEA-2045000> <The application bundle "OpenSpan_Tutorial" was deployed successfully to file:/D:/Oracle/Middleware/user_projects/domains/ocep_domain/defaultserver/applications/OpenSpan_Tutorial/OpenSpan_Tutorial.jar with version 1300499030501>
<Mar 18, 2011 9:43:51 PM EDT> <Notice> <Spring> <BEA-2047000> <The application context for "OpenSpan_Tutorial" was started successfully>

Friday, March 18, 2011

Desktop Events with OpenSpan and Oracle CEP - Part 1

Oracle’s Complex Event Processing Engine can be used to monitor large volumes of real-time data feeds but how do you enable your existing applications to trigger and react with the CEP engine?

With OpenSpan Events you can quickly and easily monitor any application or set of applications on a user’s desktop - including Windows, Web, Java, mainframe, cloud-based, virtualized or Citrix-hosted applications - without modifying the original applications. All events and associated data can be sent in real-time to Oracle CEP, as well as stored in an Oracle or other central database for analysis using OpenSpan Analytics, Oracle Hyperion or any other BI or reporting tool.

Here is a step-by-step guide to get you started with OpenSpan Events with Complex Event Processing (CEP) technology. Part 1 of this tutorial is going to cover Oracle WebLogic JMS setup.

1. Download and Install Oracle WebLogic 11g R1 (http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html)

2. Download and Install Oracle Complex Event Processing 11gR1 (http://www.oracle.com/technetwork/middleware/complex-event-processing/downloads/index.html)

3. Configure Oracle CEP plugin on Eclipse Galileo shipped with Oracle WebLogic 11g R1 (http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14301/ide_intro.htm#CHDGBGGA)

4. Start your Oracle WebLogic instance (Start Menu > Programs > Oracle WebLogic > User Projects > base_domain > Start Admin Server for WebLogic Server Domain). Wait for the confirmation the server is up and running. You should see a message on the log similar to the following:

<mar 18, 2011 2:58:30 PM EDT> <notice> <weblogicserver> <BEA-000360> <server started in RUNNING mode>

5. Log in to WebLogic Server 11g Administration Console pointing your web browser to http://localhost:7001/console.

6. Click on JMS Modules under Services > Messaging. By default, Oracle WebLogic creates a JMS Module called SystemModule-0. If you don’t have it, you’ll have to create one. Click on SystemModule-0.

7. You also have to create new Queues for the sample configuration where the message exchange between the desktop applications and the Oracle CEP server is going to happen. Click on New and then select Queue. Click Next and give it a name of osevents_SampleQ1. Click Finish. Repeat the process to create another Queue called osevents_SampleQ2.
You also have to create a new connection factory object that's used to create connections for JMS clients. Name your new connection factory object osevents_queue_cf with the same JNDI name.

8. To test your recently created configuration you may want to configure a few JMS clients to send and receive messages to/from these queues. I'd recommend you taking a look on the bottom of the following resource for a pretty nice and straightforward client configuration available at http://redstack.wordpress.com/2009/12/21/a-simple-jms-client-for-weblogic-11g/.

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...