Monitoring Events in your BPEL Runtime - RSS Feeds?

Ramkumar Menon
Director, Product Strategy

@10g -

It had been a while since I'd tried something different. so here's what I did this week!
Whenever our Developers deployed processes to the BPEL runtime, or perhaps when a process gets turned off due to connectivity issues, or maybe someone retired a process, I needed to know.
So here's what I did.

Step 1: Downloaded Quartz libraries and went through the documentation to understand what it takes to schedule a recurring job.

Step 2: Cranked out two components using Oracle JDeveloper. [Within a new Web Project]

a) A simple Java Class named FeedUpdater that extends org.quartz.Job. All this class does is to connect to your BPEL Runtime [via opmn:ormi] and fetch all events that occured in the last "n" minutes.
events? - If it doesn't ring a bell - its right there on the BPEL Console. If you click on "Administration > Process Log" - what you see are events.
The API to retrieve the events is

//get the locator reference for the domain you are interested in.
Locator l = ....

//Predicate to retrieve events for last "n" minutes
WhereCondition wc = new WhereCondition(...)

//get all those events you needed.
BPELProcessEvent[] events = l.listProcessEvents(wc);

After you get all these events, write out these into an RSS Feed XML structure and stream it into a file that resides either in your Apache htdocs, or wherever it can be accessed via HTTP.
You can read all about RSS 2.0 here. At a high level, here is how it looks like.

<?xml version = '1.0' encoding = 'UTF-8'?>
<rss version="2.0">
    <title>Live Updates from the Development Environment</title>
    <description>Live Updates from the Development Environment</description>
    <lastBuildDate>Fri, 19 Nov 2010 01:03:00 PST</lastBuildDate>
      <title>Process compiled</title>
      <pubDate>Fri Nov 19 00:00:37 PST 2010</pubDate>
      <description>SendPurchaseOrderRequestService: 3.0 Time : Fri Nov 19 00:00:37
                   PST 2010</description>




For writing ut XML content, read through Oracle XML Parser APIs - [search around for oracle.xml.parser.v2]

b) Now that my "Job" was done, my job was half done. Next, I wrote up a simple Scheduler Servlet that schedules the above "Job" class to be executed ever "n" minutes. It is very straight forward.

Here is the primary section of the code.

        try {
        Scheduler sched = StdSchedulerFactory.getDefaultScheduler();

        //get n and make a trigger that executes every "n" seconds
        Trigger trigger = TriggerUtils.makeSecondlyTrigger(n);
        trigger.setName("feedTrigger" + System.currentTimeMillis());
        JobDetail job = new JobDetail("SOA_Feed" + System.currentTimeMillis(), "feedGroup", FeedUpdater.class);

        }catch(Exception ex) {
            throw new ServletException(ex.getMessage());

Look up the Quartz API and documentation. It will make this look much simpler.

Now that both components were ready, I packaged the Application into a war file and deployed it onto my Application Server. When the servlet initialized, the "n" second schedule was set/initialized.

From then on, the servlet kept populating the RSS Feed file. I just ensured that my "Job" code keeps only 30 latest events within it, so that the feed file is small and under control. [a few kbs]

Next I opened up the feed xml on my browser - It requested a subscription - and Here I was - watching new deployments/life cycle events all popping up on my browser toolbar every 5 (actually n)  minutes!


Well, you could do it on a browser/reader of your choice - or perhaps read them like you read an email on your thunderbird!.


Join the discussion

Comments ( 2 )
  • Duane Berstler Tuesday, April 26, 2011
    I simply needed to appreciate you yet again. I am not sure the things that I would have handled without those tips contributed by you directly on such a situation. It absolutely was a very fearsome situation in my position, but viewing a new expert style you solved that forced me to cry with gladness. Extremely happy for your service and even hope you really know what an amazing job you're accomplishing instructing men and women via your website. I am certain you have never met all of us.
  • Rosalind Ferrell Friday, April 29, 2011
    Will there be another methods to be connected with the site with no signing up on the RSS? I am not sure exactly why but I can’t get the RSS loaded at my reader even though I can see that from my chrome.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.