// Kill the route so some new message does not get routed to
// same process instance.
correlator.removeRoutes(messageRoute.getGroupId(), instanceDAO);
// send process instance event
CorrelationMatchEvent evt = new CorrelationMatchEvent(_process.getProcessModel().getQName(),
_process.getProcessDAO().getProcessId(), instanceDAO.getInstanceId(), matchedKey);
evt.setPortType(mex.getPortType());
evt.setOperation(operation.getName());
evt.setMexId(mex.getMessageExchangeId());
_process._debugger.onEvent(evt);
// store event
_process.saveEvent(evt, instanceDAO);
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.MATCHED.toString());
mex.setInstance(messageRoute.getTargetInstance());
// We're overloading the channel here to be the PICK response channel + index
mex.setChannel(messageRoute.getGroupId() + "&" + messageRoute.getIndex());
} else {
if (__log.isDebugEnabled()) {
__log.debug("INPUTMSG: " + correlatorId + ": SAVING to DB (no match) ");
}
// TODO: Revist (BART)
// if (!mex.isAsynchronous()) {
// mex.setFailure(MessageExchange.FailureType.NOMATCH, "No process instance matching correlation keys.", null);
//
// } else {
// send event
CorrelationNoMatchEvent evt = new CorrelationNoMatchEvent(mex.getPortType(), mex.getOperation(), mex
.getMessageExchangeId(), processKeys);
evt.setProcessId(_process.getProcessDAO().getProcessId());
evt.setProcessName(_process.getProcessModel().getQName());
_process._debugger.onEvent(evt);
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.QUEUED.toString());
correlator.enqueueMessage(mex, processKeys);
}