*/
public void matcherEvent(String correlatorId, CorrelationKeySet ckeySet) {
if (BpelProcess.__log.isDebugEnabled()) {
__log.debug("MatcherEvent handling: correlatorId=" + correlatorId + ", ckeySet=" + ckeySet);
}
CorrelatorDAO correlator = _dao.getProcess().getCorrelator(correlatorId);
// Find the route first, this is a SELECT FOR UPDATE on the "selector" row,
// So we want to acquire the lock before we do anthing else.
List<MessageRouteDAO> mroutes = correlator.findRoute(ckeySet);
if (mroutes == null || mroutes.size() == 0) {
// Ok, this means that a message arrived before we did, so nothing to do.
__log.debug("MatcherEvent handling: nothing to do, route no longer in DB");
return;
}
// Now see if there is a message that matches this selector.
MessageExchangeDAO mexdao = correlator.dequeueMessage(ckeySet);
if (mexdao != null) {
__log.debug("MatcherEvent handling: found matching message in DB (i.e. message arrived before <receive>)");
if( MessageExchangePattern.REQUEST_RESPONSE.toString().equals(mexdao.getPattern())) {
__log.warn("A message arrived before a receive is ready for a request/response pattern. This may be processed to success. However, you should consider revising your process since this may cause performance degradataion");
}
Set<String> groupIds = new HashSet<String>();
for (MessageRouteDAO mroute : mroutes) {
// We have a match, so we can get rid of the routing entries.
groupIds.add(mroute.getGroupId());
// Found message matching one of our selectors.
if (BpelProcess.__log.isDebugEnabled()) {
BpelProcess.__log.debug("SELECT: " + mroute.getGroupId() + ": matched to MESSAGE " + mexdao
+ " on CKEYSET " + ckeySet);
}
MyRoleMessageExchangeImpl mex = new MyRoleMessageExchangeImpl(_bpelProcess, _bpelProcess._engine, mexdao);
inputMsgMatch(mroute.getGroupId(), mroute.getIndex(), mex);
execute();
}
for (String groupId : groupIds) {
correlator.removeRoutes(groupId, _dao);
}
// Do not release yet if the process is suspended, the mex will be used again
if (_dao.getState() != ProcessState.STATE_SUSPENDED)
mexdao.releasePremieMessages();