Monday, August 31, 2015

BPM Suite 12c: Oracle Adaptive Case Management: Monitoring Case Events

Oracle Adaptive Case Management (ACM) is an interesting addition to Oracle BPM Suite which has been introduced in Adaptive Case Management is suitable to model complex work-flows in which there is no set order of activities taking place. This allows more control to the end user on what to do when.

When a case is started, it is a running process in the SOA infrastructure. The main component is Oracle Business Rules which governs (among other things) the availability of activities and when certain process milestones are achieved. The case API allows you to query the case events and milestones (how you can expose the API as a service is described here and here by Roger Goossens).

Sometimes people want to obtain information about cases such as;
  • in how many cases has a certain activity been executed?
  • in which cases has a certain milestone been reached?
Cases can crash, be restarted, migrated, aborted, purged, etc. Sometimes you might not want to depend on the running case being there to provide the information you want. Also using the API every time you want certain information might put a serious strain on your system. Using sensors or BAM might help but they require an investment to implement and are still manual implementations with no guarantee you can obtain information in the future you did not think you would need in the present/past.

Publish Case Events

Luckily Oracle has provided the perfect solution for monitoring case events! You can publish case events to the Event Delivery Network (read here 31.17.2 How to Publish Case Events). This can easily be monitored by for example a BPEL process, which can store the information in a custom table.

You can find the event definition of a case event in the MDS at oramds:/soa/shared/casemgmt/CaseEvent.edl

Publishing case events does not work however when using the (BPM 12.1.3) quickstart installation (with the Derby database). I got the below error:

Caused By: 'EDN_INTERNAL_PUBLISH_EVENT' is not recognized as a function or procedure.
    at Source)
    at Source)
    at Source)
    at Source)
    at Source)
    at Source)
    at Source)

The PL/SQL procedure EDN_INTERNAL_PUBLISH_EVENT apparently is used when publishing EDN (Event Delivery Network) events from the Case. Of course the quickstart Derby database doesn't have PL/SQL support.

I quickly (Vagrant/Puppet) created a full blown SOA Suite 12c installation with a serious Oracle database to continue (from the following article by Lucas Jellema using scripts from Edwin Biemond). When enabling debug logging for the Event Delivery Network (see here) I could see the following (this is a sample event).

[SRC_METHOD: fineEventPublished] Received event: Subject: null  Sender: oracle.integration.platform.blocks.event.saq.SAQRemoteBusinessEventConnection   Event:[[
<business-event xmlns:ns="" xmlns="">
      <ce:caseEvent xmlns:ce="" eventType="ACTIVITY_EVENT">

Thus the event was published to the EDN... at least I thought it was.

Debugging EDN

In order to retrieve events, I created a small case and logger BPEL process as sample. You can download them here. The logger stores events on the filesystem. You can of course easily expand this to store the information in a database table. The sample logger process also shows how you can Base64 encode the event for the fileadapter.
My CaseEventLogger process however did not pickup the EDN events.

Removing EDNDataSource and EDNLocalTxDataSource

I read however (here) that two datasources (EDNDataSource and EDNLocalTxDataSource) needed to be removed for the WLJMS implementation of EDN in 11g to work (default is AQJMS). In 12c the WLJMS implementation is default so I tried removing the datasources and restarted my soa-infra. Next I got the following errors:

Exception in publishing business event[[
    at oracle.bpm.casemgmt.event.CaseEventEDNPublisher.publish(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

This was curious since ACM was not supposed to use the EDN datasources (that I had just removed). Remember the logging I posted before? SAQRemoteBusinessEventConnection was used. Why AQ? (hardcoded in CaseEventEDNPublisher?).

When publishing an event from the Enterprise Manager I see logging like;

[SRC_METHOD: publish] EDN outbound: JMS Config: [remote=false, jmsType=WLJMS, durable=true, xa=true, connectionName=eis/wls/EDNxaDurableTopic, topicName=jms/fabric/EDNTopic]

I also see other logging from oracle.integration.platform.blocks.event.jms2.EdnBus12c. This is a class the Case does not seem to use. The Case uses oracle.integration.platform.blocks.event.saq.SAQBusinessEventBus.

Setting the implementation to AQJMS

In order to confirm this finding, I set the EDN implementation to AQJMS (this MBean:,name=edn,type=EDNConfig,Application=soa-infra) and redeployed my logger process is order to have it use the correct datasource (you can also alter it at runtime from the Enterprise Manager in the Business Event screen).

I still didn't see my event arrive in my logger process. I did see however the EDN activation:

[SRC_METHOD: log] eis/aqjms/EDNxaDurableTopic EdnBus12c Populating ActivationSpec oracle.tip.adapter.jms.inbound.JmsConsumeActivatio
nSpec with properties: {UseNativeRecord=false, DurableSubscriber=CaseEventd_SCA_60016, PayloadType=TextMessage, UseMessageListener=false, MessageSelector=EDN$namespace = '' AND EDN$localName
= 'CaseEvent', endpoint.ActionSpec.className=oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec, DestinationName=jms/fabric/EDNAQjmsTopic}

Maybe I shouldn't use the new (and very useful!) 12c durable subscriber feature? Lets retry without.

[SRC_METHOD: log] eis/aqjms/EDNxaTopic EdnBus12c Populating ActivationSpec oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec w
ith properties: {UseNativeRecord=false, PayloadType=TextMessage, UseMessageListener=false, MessageSelector=EDN$namespace = '' AND EDN$localName = 'CaseEvent', endpoint.ActionSpec.className=or
acle.tip.adapter.jms.inbound.JmsConsumeActivationSpec, DestinationName=jms/fabric/EDNAQjmsTopic}

They both use (check the JmsAdapter configuration) jms/fabric/EDNAQjmsTopicXAConnectionFactory. In the soajmsmodule, you can find the topic used: EDN_AQJMS_TOPIC.

But what does the Case do?

When looking at what the class used by the Case for publishing events does, we see something different. The oracle.integration.platform.blocks.event.saq.SAQBusinessEventBus class is used by the oracle.integration.platform.blocks.event.saq.SAQBusinessEventConnection class of which we see logging. The SAQBusinessEventBus class uses the EDN_EVENT_QUEUE (indirectly, via the EDN_INTERNAL_PUBLISH_EVENT procedure, which you could also see in the first error when still using the Derby quickstart database). When looking at the database, my messages also appeared to have ended up there.


Thus in Adaptive Case Management 12c (I've used publishing of case events to the event delivery network does not work yet (and this should not be something which we should fix on our own). In Adaptive Case Management 11g we do not have guaranteed delivery when using the EDN. Thus currently this feature cannot be used yet to for example obtain management information about cases since in 11g it is not guaranteed all case events are delivered and in 12c it does not work.

If it could be used, it would be great to for example store case events in a data-warehouse and allow a management information department to query on the results. It requires minimal effort to implement and has the potential to provide a lot of (business relevant) information.


EDN Debugging

SOA 12c – EDN –Using AQ JMS

BPM Suite with Adaptive Case Management (ACM) User Interface available for download

How to Publish Case Events

Rapid creation of Virtual Machine(s) for SOA Suite 12.1.3 server run time environment – leveraging Vagrant, Puppet and Biemond

How to Configure JMS-based EDN Implementations

Sample case and logger process