Monday Nov 26, 2007

Miscellaneous Ant tasks for Managing the BPEL Server

The serverAdmin ANT task

This news item describes a simple ant task that I had come up named serverAdmin that allows you to

  • Selectively undeploy BPEL Processes
  • Selectively purge BPEL process instances.
  • Cancel and Recover Invocation Messages
  • Cancel and Recover Callback Messages
  • Get one or more domain configuration properties
  • Set one or more domain configuration properties
  • Fetch the latest domain log from the Server
  • Create/delete a domain on the BPEL server

Setup and Usage


To setup this task, perform the following steps.

  • Copy the admintasks.jar from http://blogs.oracle.com/ramkumarMenon/gems/admintasks.jar into $ORACLE_HOMEintegrationlib directory.

  • Open up ant-orabpel.xml in $ORACLE_HOMEbpelutilities directory and paste the following piece of code into the file within the element.

<path id="admin.tasks.class.path">
   <pathelement location="${bpel.home}/../lib/admintasks.jar"/>
  </path>
  <property name="admin.tasks.class.path" refid="admin.tasks.class.path"/>
  <taskdef name="serverAdmin" classname="com.collaxa.cube.ant.taskdefs.ServerAdmin">
    <classpath>
      <pathelement path="${admin.tasks.class.path}"/>
    </classpath>
  </taskdef>

Illustrative Command Syntax

      <serverAdmin  providerURL="opmn:ormi://<hostName>:<opmnRequestPort>:<oc4jInstanceName>/orabpel"  userName="oc4jadmin" providerURL="opmn:ormi://::/orabpel">
      <serverAdmin  providerURL="opmn:ormi://<hostName>:<opmnRequestPort>:<oc4jInstanceName>/orabpel" userName="oc4jadmin" password="<pwdforoc4jadmin>">
       <createDomain domainName="testDomain"/>
       <deleteDomain domainName="testDomain"/>
       <manageDomain domain="default">
              <undeployProcesses select="BPELProcess.*"  type="all" revision="all"/>
              <undeployProcesses select="TestXPath"  type="retired" revision="all"/>
             <undeployProcesses select="Sample.*" type="all" revision="2.0"/>
             <undeployProcesses select="SampleProcess" type="active" revision="1.0"/>
         <!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z"   "1994-11-05T08:15:30 -0800-->
         <!--example date format "yyyy-MM-dd"   "1994-11-05"-->
          <purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
          <purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
             <getProperties propertyNames="dspMinThreads,dspMaxThreads,syncMaxWaitTime"/>
              <setProperty name="dspMinThreads" value="5"/>
              <cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>
              <recoverInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>
              <cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              <recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              <printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>
          <purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>
          <purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>
          <purgeInstances select="SampleProcess" type="closed.completed"  toDateTime="2007-10-31"/>
          <purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>
          <purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />
         <purgeInstances/>
        </manageDomain>
      </serverAdmin>

Short Description


1. UnDeployProcesses subtask


The select argument for "undeployProcesses" subtask accepts both exact process names, as well as java regex expressions. For instance, the above example shows undeployment for all processes whose name starts with the string "BPELProcess".
All arguments are mandatory.If you wish to specify "all" values for one or more arguments, specify them in the format ="all". For instance, you can specify type="all" or revision="all" or select="all" to indicate selection of all process states, all revisions or all processes.

2. PurgeInstances subtask


If fromDateTime/fromDate is omitted, it purges every matching instance upto and including the "toDateTime/toDate". Note that in case you specify a date as opposed to a dateTime, the time is defaulted to the beginning of the date. [i.e. 12 AM]
If the "toDateTime/toDate" is omitted, it purges every matching instance till the present.
If both are specified, the task purges all matching instances including and between the given timespan.
If both are omitted, the task purges all matching instances irrespective of the time.
The dateTime has to be specified in the format given in the above example.
The "type" attribute, if omitted, is equivalent to "all". The other values are

  • closed.aborted
  • closed.cancelled
  • closed.completed
  • closed.faulted
  • closed.stale
  • closed.pendingCancel
  • initiated
  • open.running
  • open.faulted
  • open.suspended

Each serverAdmin task can be used to administer a different BPEL runtime.
Within each serverAdmin, you can provide multiple tasks, one for each domain to purge and undeploy processes and instances in each domain.


3. Print Log Subtask


Prints the domain log

4. SetProperty subtask


Sets a domain property. e.g. dspMaxThreads

5. GetProperties subtask


Gets the property values for the given set of domain properties.[comma separated]

6. Recovery/Cancellation/Deletion of Invocation or callback subtasks


Recovers, deletes or cancels invocations/callback. Arguments to this task are the processName, revision, the from/to date or dateTimes in the given format as specified in the example. [yyyy-MM-dd'T'HH:mm:ss Z or yyyy-MM-dd]

7. Create Domain subtask


Creates a domain with the given name.

8. Delete Domain subtask


Deletes the domain with the given name.
Notes:
Ensure that BPEL_HOME and ORACLE_HOME are properly set.
Sample Build File

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="ServerAdminBuild" default="deploy" basedir=".">
    <!--=============================-->
    <!-- Process deployment targets  -->
    <!--=============================-->
    <!-- Set bpel.home from developer prompt's environment variable BPEL_HOME -->
    <condition property="bpel.home" value="${env.BPEL_HOME}">
        <available file="${env.BPEL_HOME}/utilities/ant-orabpel.xml"/>
    </condition>
    <!-- If bpel.home is not yet using env.BPEL_HOME, set it for JDev -->
    <property name="bpel.home" value="${oracle.home}/integration/bpel"/>
    <!-- First override from build.properties in process.dir, if available -->
    <property file="${process.dir}/build.properties"/>
    <!-- import custom ant tasks for the BPEL PM -->
    <import file="${bpel.home}/utilities/ant-orabpel.xml"/>
    <target name="adminTasks">
      <serverAdmin  providerURL="opmn:ormi://server.host.com:6004:oc4j_soa/orabpel" userName="oc4jadmin" password="welcome1">
        <manageDomain domain="default">
              <undeployProcesses select="BPELProcess.*"  type="all" revision="all"/>
             <getProperties propertyNames="dspMinThreads"/>
              <setProperty name="dspMinThreads" value="5"/>
              <cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>
              <recoverlInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>
              <cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              <recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>
              <printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>
              <undeployProcesses select="TestXPath"  type="retired" revision="all"/>
             <undeployProcesses select="Sample.*" type="all" revision="2.0"/>
             <undeployProcesses select="SampleProcess" type="active" revision="1.0"/>
         <!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z"   "1994-11-05T08:15:30 -0800-->
         <!--example date format "yyyy-MM-dd"   "1994-11-05"-->
          <purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
          <purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>
          <purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>
          <purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>
          <purgeInstances select="SampleProcess" type="closed.completed"  toDateTime="2007-10-31"/>
          <purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>
          <purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />
         <purgeInstances/>
        </manageDomain>
      </serverAdmin>
    </target>
</project>














     

About

Principal Product Manager

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today