JobDetails we = jobDetail;
__log.debug("handleJobDetails " + jobDetail + " " + when);
if (we.getType() == JobType.INVOKE_INTERNAL) {
final BpelProcess p = engine._activeProcesses.get(we.getProcessId());
final ProcessDAO processDAO = p.getProcessDAO();
final MyRoleMessageExchangeImpl mex = (MyRoleMessageExchangeImpl) engine.getMessageExchange(we.getMexId());
p.invokeProcess(mex,
// time,
new BpelProcess.InvokeHandler() {
public boolean invoke(PartnerLinkMyRoleImpl target, RoutingInfo routing, boolean createInstance) {
if (routing.messageRoute == null && createInstance) {
__log.debug("creating new instance via live communication mex:" + mex);
ProcessInstanceDAO newInstance = processDAO.createInstance(routing.correlator);
ReplayerContext context = new ReplayerContext(null);
context.bpelEngine = (BpelEngineImpl) engine;
contexts.add(context);
ReplayerBpelRuntimeContextImpl runtimeContext = new ReplayerBpelRuntimeContextImpl(p, newInstance, new PROCESS(p.getOProcess()), mex,
// time,
context);
context.runtimeContext = runtimeContext;
runtimeContext.setCurrentEventDateTime(when);
runtimeContext.updateMyRoleMex(mex);
// first receive is matched to provided
// mex
runtimeContext.execute();
return true;
} else if (routing.messageRoute != null) {
long iid = routing.messageRoute.getTargetInstance().getInstanceId();
ReplayerContext ctx = findReplayedInstance(iid);
if (ctx == null) {
throw new IllegalStateException("Trying to hit existing instance via live communication, but there's no such instance mex:" + mex + " iid:" + iid);
}
__log.debug("hitting existing instance via live communication mex:" + mex + " iid:" + iid);
ctx.runtimeContext.inputMsgMatch(routing.messageRoute.getGroupId(), routing.messageRoute.getIndex(), mex);
routing.correlator.removeRoutes(routing.messageRoute.getGroupId(), ctx.runtimeContext.getDAO());
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.MATCHED);
mex.getDAO().setInstance(routing.messageRoute.getTargetInstance());
ctx.runtimeContext.execute();
}
return false;
}
}, true);