Example #1
0
  public void noRoutingMatch(MyRoleMessageExchangeImpl mex, List<RoutingInfo> routings) {
    if (!mex.isAsynchronous()) {
      mex.setFailure(
          MessageExchange.FailureType.NOMATCH,
          "No process instance matching correlation keys.",
          null);
    } else {
      // enqueue message with the last message route, as per the comments in caller (@see
      // BpelProcess.invokeProcess())
      RoutingInfo routing =
          (routings != null && routings.size() > 0) ? routings.get(routings.size() - 1) : null;
      if (routing != null) {
        if (__log.isDebugEnabled()) {
          __log.debug(
              "INPUTMSG: " + routing.correlator.getCorrelatorId() + ": SAVING to DB (no match) ");
        }

        // send event
        CorrelationNoMatchEvent evt =
            new CorrelationNoMatchEvent(
                mex.getPortType().getQName(),
                mex.getOperation().getName(),
                mex.getMessageExchangeId(),
                routing.wholeKeySet);

        evt.setProcessId(_process.getProcessDAO().getProcessId());
        evt.setProcessName(
            new QName(_process.getOProcess().targetNamespace, _process.getOProcess().getName()));
        _process._debugger.onEvent(evt);

        mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.QUEUED);

        // No match, means we add message exchange to the queue.
        routing.correlator.enqueueMessage(mex.getDAO(), routing.wholeKeySet);
      }
    }
  }