Search This Blog

Wednesday, May 16, 2018

How to Invoke "Refresh Alarm Table" from a Java Code

How to Invoke "Refresh Alarm Table" from a Java Code
In a BPEL process there are some use cases where a Wait activity or the onAlarm branch of a Pick activity is needed. An example for an onAlarm branch is a timeout mechanism for an asynchronous call. These activities save the instance in the dehydration store for a defined time. To wake up the waiting instances there is a quartz scheduler job running in the weblogic and check the expiration date in the dehydration store. For the case the dehydration store  is not available, the scheduler retry to call the database. The retry settings can be found in the advanced BPEL properties in the System MBean Browser. 

The properties are named ExpirationMaxRetry and ExpirationRetryDelay. When the retry failed the data sets won’t be cleaned from the dehydration store.

The suggestion to clean this is to click on the Button “Refresh Alarm Table” in the Recovery console. But it is unpleasent to click the button periodically, so the wish appear to do this automated. There is a way for an automatically clean.

This Note explains how to achieve this functionality using DB Update stament



This also can be achieved using the following java code 

++
package hello2;

import java.util.Hashtable;
import java.util.List;
import javax.naming.Context;
import oracle.soa.management.facade.Locator;
import oracle.soa.management.facade.LocatorFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;


public class Class1 {
   public Class1() {
       super();
   }

   //Invoke this method with the composite instance id
      public static void main(String[] args) {
          String compositeName = "GetOpenCompositeInstances";
          Hashtable jndiProps = new Hashtable();
          String inputPayload = "";
          try {
              jndiProps.put(Context.PROVIDER_URL, "t3://xxxxx:7001");
              jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
              jndiProps.put(Context.SECURITY_CREDENTIALS, "Welcome1");
              jndiProps.put("dedicated.connection", "true");
              Locator locator = LocatorFactory.createLocator(jndiProps);
             
              Object[] params = new Object[] {};
              ((oracle.soa.management.internal.facade.Locator)locator).executeServiceEngineMethod("bpel", "refreshAlarmTable", params);
              System.out.println(" Executed refreshAlarmTable");
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
}

+++

Create a new project from JDev and add the following the libraries 

SOA Designtime
SOA Runtime
BPEL Runtime
Mediator Runtime
MDS Runtime
BC4J Service Runtime
WebLogic 12.1 Remote-Client
JRF Client

to run the java code Use the classpath as ,


c:\jdk1.8.0_152\bin\java.exe -server -classpath C:\myjdevwork\jdev12212\mywork\Application1\.adf;C:\myjdevwork\jdev12212\mywork\Application1\Hello2\SOA\SCA-INF\classes;D:\bpm12212\soa\plugins\jdeveloper\extensions\oracle.sca.modeler.jar;D:\bpm12212\soa\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar;D:\bpm12212\soa\soa\modules\oracle.soa.fabric_11.1.1\tracking-api.jar;D:\bpm12212\soa\soa\modules\oracle.soa.fabric_11.1.1\tracking-core.jar;D:\bpm12212\soa\soa\modules\oracle.soa.fabric_11.1.1\edn.jar;D:\bpm12212\soa\soa\modules\oracle.soa.mgmt_11.1.1\soa-infra-mgmt.jar;D:\bpm12212\oracle_common\modules\com.oracle.webservices.fabric-common-api.jar;D:\bpm12212\soa\soa\modules\oracle.soa.bpel_11.1.1\orabpel.jar;D:\bpm12212\soa\soa\modules\oracle.soa.mediator_11.1.1\mediator_client.jar;D:\bpm12212\oracle_common\modules\oracle.mds\mdsrt.jar;D:\bpm12212\oracle_common\modules\oracle.adf.model\adfbcsvc.jar;D:\bpm12212\oracle_common\modules\oracle.adf.model\adfbcsvc-share.jar;D:\bpm12212\oracle_common\modules\commonj.sdo.backward.jar;D:\bpm12212\oracle_common\modules\commonj.sdo.jar;D:\bpm12212\oracle_common\modules\oracle.toplink\eclipselink.jar;D:\bpm12212\oracle_common\modules\com.oracle.webservices.fmw.wsclient-impl.jar;D:\bpm12212\oracle_common\modules\com.oracle.webservices.fmw.jrf-ws-api.jar;D:\bpm12212\oracle_common\modules\com.oracle.webservices.fmw.web-common-schemas-impl.jar;D:\bpm12212\wlserver\server\lib\weblogic.jar;D:\bpm12212\oracle_common\modules\clients\com.oracle.webservices.fmw.client.jar hello2.Class1
Executed refreshAlarmTable

To check the log entries enable the following logger , oracle.soa.bpel.engine.agents

Log entries after enabling the oracle.soa.bpel.engine.agents to TRACE:32

[2018-05-14T13:51:27.595+05:30] [AdminServer] [TRACE] [] [oracle.soa.bpel.engine.agents] [tid: [ACTIVE].ExecuteThread: '30' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: weblogic] [ecid: dfe28b74-fb6c-46fa-95cb-c692ece98681-03646479,0] [APP: soa-infra] [partition-name: DOMAIN] [tenant-name: GLOBAL] [SRC_CLASS: ExpirationAgent] [SRC_METHOD: recover] Attempting to find expirable work items
[2018-05-14T13:51:27.597+05:30] [AdminServer] [TRACE] [] [oracle.soa.bpel.engine.agents] [tid: [ACTIVE].ExecuteThread: '30' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: weblogic] [ecid: dfe28b74-fb6c-46fa-95cb-c692ece98681-03646479,0] [APP: soa-infra] [partition-name: DOMAIN] [tenant-name: GLOBAL] [SRC_CLASS: ExpirationAgent] [SRC_METHOD: recover] Cluster date time retrieved from DB is 2018-05-14 13:51:27.0
[2018-05-14T13:51:27.597+05:30] [AdminServer] [TRACE] [] [oracle.soa.bpel.engine.agents] [tid: [ACTIVE].ExecuteThread: '30' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: weblogic] [ecid: dfe28b74-fb6c-46fa-95cb-c692ece98681-03646479,0] [APP: soa-infra] [partition-name: DOMAIN] [tenant-name: GLOBAL] [SRC_CLASS: ExpirationAgent] [SRC_METHOD: recover] Found NO expirable work items for bpel engine.





Tags: Publish
May 16, 2018 at 12:05PM
Open in Evernote

2 comments:

rmouniak said...

It's Very Nice article
Oracle SOA Online Course

maha said...

I’m really happy to say it was an interesting post to read. I learned new information from your article. You are doing a great job. Very informative article.Thank you admin for you valuable points.Keep Rocking.

Digital Marketing Training in Chennai

Digital Marketing Course in Chennai