Thursday, November 17, 2011

Oracle SOA Suite - Abort the running composite instances through JAVA API


Abort the running Oracle SOA Suite composite instances through JAVA API:

Sometimes we may required to abort the running composite instances, the JAVA APIs can be used to abort the running instances of a composite. To abort the instance, we have to identify the running composite instances based on the instance state and the same can be aborted by using the abort method available in the CompositeInstance class.

The below code snippet will help us to abort the running instance of the particular composite, the filter condition can be changed accordingly to abort the running composite instances with different matching criteria.

try
{
String compositeName="GetDomainID";
Hashtable jndiProps = new Hashtable();
jndiProps.put(Context.PROVIDER_URL,"t3://soahost:soaport");
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
jndiProps.put(Context.SECURITY_PRINCIPAL,"weblogic");
jndiProps.put(Context.SECURITY_CREDENTIALS,"xxxxx");
jndiProps.put("dedicated.connection","true");
Locator locator = LocatorFactory.createLocator(jndiProps);
CompositeInstanceFilter filter =new CompositeInstanceFilter();
filter.setState(CompositeInstance.STATE_RUNNING);
filter.setCompositeName(compositeName);
// filter.setId("670002");
List<CompositeInstance> compositeInstances = locator.getCompositeInstances(filter);
for(int i=0;i<compositeInstances.size();i++)
((CompositeInstance)compositeInstances.get(i)).abort();
}catch(Exception e)
{
e.printStackTrace();
}

Execution of this code will abort all the running instances of a specified composite.

Jar files - 

$Middleware_Home\Oracle_Home\oracle_common\modules\internal\features\jrf_wlsFmw_oracle.jrf.wls.classpath.jar
$Middleware_Home\Oracle_Home\soa\soa\modules\oracle.soa.fabric_11.1.1\oracle.soa.fabric.jar
$Middleware_Home\Oracle_Home\wlserver\server\lib\weblogic.jar


5 comments:

  1. Can you provide the complete code for this..

    Thanks,
    Pradeep

    ReplyDelete
  2. Could you please provide the code for 12c?

    Regards,
    Phani\

    ReplyDelete
    Replies

    1. Hi jetendra71 do you have the code?

      Delete
  3. Abort the running composite instances through JAVA API SOA 12С, Is it possible, who tried it???

    ReplyDelete
  4. Oracle SOA Suite - Abort the running composite instances through JAVA API 12С!!!
    Is it possible, who tried it????

    ReplyDelete