コード例 #1
0
  private boolean processMessageForContinuation(KoalaMessage message) {
    if (message.getResponseCode() == null) return false;

    boolean continuationProcessed = false;
    RequestState<Continuation<KoalaMessage, Exception>> continuationState =
        continuationMap.get(message.getCorrelationUID());
    if (continuationState != null) {
      continuationState.getResponse().receiveResult(message);
      continuationMap.remove(message.getCorrelationUID());
      continuationProcessed = true;
    }
    return continuationProcessed;
  }
コード例 #2
0
  @Override
  public boolean messageReceived(PId id, KoalaMessage message) {
    LOG.debug(String.format("messageReceived(%s, %s)", id, message.getClass().getSimpleName()));
    MDCHelper.putTransactionUID(message.getTransactionUID());

    boolean continuationProcessed = false;
    LOG.debug(String.format("messageReceived(Id - %s,KoalaMessage - %s)", id, message));
    if (StringUtils.isNotBlank(message.getCorrelationUID())) {
      continuationProcessed = processMessageForContinuation(message);
    }

    MDCHelper.clearTransactionUID();
    return continuationProcessed;
  }
コード例 #3
0
  @Override
  public void sendRequest(
      PId id,
      KoalaMessage message,
      KoalaMessageSender messageSender,
      Continuation<KoalaMessage, Exception> continuation) {
    LOG.debug(
        String.format(
            "sendRequest(Id - %s,KoalaMessage - %s, Sender - %s, Continuation - %s)",
            id, message, messageSender, continuation));
    if (continuation == null || StringUtils.isNotBlank(message.getCorrelationUID())) {
      RequestState<Continuation<KoalaMessage, Exception>> continuationRequestState =
          new RequestState<Continuation<KoalaMessage, Exception>>();
      continuationRequestState.setResponse(continuation);
      continuationMap.put(message.getCorrelationUID(), continuationRequestState);
    } else
      LOG.warn(
          String.format(
              "sendRequest called with message: %s  to Id: %s containing no continuation or CorrelationUID. Skipping adding message to hash",
              id, message));

    messageSender.routeMessage(id, message);
  }