So if you need to do things with your BPC process instances in IBM Websphere you might find this article useful.
First if you want to get to a process instance you want to locate the Business Flow Manager (because it is an EJB) and use the obtained object to delete, terminate and do whatever action you need with a process, check BusinessFlowManager's API here. And by getting the Process Instance itself (see API here), a ProcessInstanceData object needs to be obtained, for example by id: bfm.getProcessInstance(PIID id) or bfm.getProcessInstance(String identifier);
ok, just to make it more clear:
In Java :
...
//initialize context and lookup the home interface
InitialContext context= new InitialContext();
Object object = context.lookup("com/ibm/bpe/api/BusinessFlowManagerHome");
//typecast (narrow down) the object to BusinessFlowManagerHome
BusinessFlowManagerHome bfmHome =
(BusinessFlowManagerHome)javax.rmi.PortableRemoteObject.narrow(object,
BusinessFlowManagerHome.class);
//Access the remote interface for the BusinessFlowManager bean
BusinessFlowManager bfm = bfmHome.create();
String id= "_PI:90030128.f2ab6a6e.bc87e953.d13606e2");
ProcessInstaceData pd = fm.getProcessInstance(id);
if (ProcessInstaceData.STATE_FAILEDSTATE_RUNNING.equals(pd.getExecutionState())) {
bfm.delete();
}
...
In Jhyton:
from javax.naming import InitialContext
from java.util import Hashtable
env = Hashtable()
env.put("java.naming.factory.initial","com.ibm.websphere.naming.WsnInitialContextFactory")
//server's ip and bootstrap port (found in the admin console application servers->ports)
env.put("java.naming.provider.url","corbaloc:iiop:112.24.120.11:1111")
context = InitialContext(env)
home = context.lookup("com/ibm/bpe/api/BusinessFlowManagerHome")
bfm = home.create()
processInstance = bfm.getProcessInstance(piid)
execState = processInstance.getExecutionState()
if execState == processInstance.STATE_FAILED :
print "failed"
bfm.delete(piid)
elif execState == processInstance.STATE_RUNNING :
print "running"
bfm.forceTerminate(piid)
bfm.delete(piid)
You can refer the examples for Java and documentation for Jhyton.
Niciun comentariu:
Trimiteți un comentariu