public boolean mediate(MessageContext synCtx, ContinuationState contState) {
    SynapseLog synLog = getLog(synCtx);

    if (synLog.isTraceOrDebugEnabled()) {
      synLog.traceOrDebug("Aggregate mediator : Mediating from ContinuationState");
    }

    boolean result;

    SequenceMediator onCompleteSequence = getOnCompleteSequence();
    RuntimeStatisticCollector.openLogForContinuation(
        synCtx, onCompleteSequence.getSequenceNameForStatistics(synCtx));
    if (!contState.hasChild()) {
      result = onCompleteSequence.mediate(synCtx, contState.getPosition() + 1);
    } else {
      FlowContinuableMediator mediator =
          (FlowContinuableMediator) onCompleteSequence.getChild(contState.getPosition());
      RuntimeStatisticCollector.openLogForContinuation(
          synCtx, ((Mediator) mediator).getMediatorName());

      result = mediator.mediate(synCtx, contState.getChildContState());

      ((Mediator) mediator).reportStatistic(synCtx, null, false);
    }
    onCompleteSequence.reportStatistic(synCtx, null, false);
    return result;
  }
Пример #2
0
  public boolean mediate(MessageContext synCtx, ContinuationState continuationState) {
    SynapseLog synLog = getLog(synCtx);

    if (synLog.isTraceOrDebugEnabled()) {
      synLog.traceOrDebug("Invoke mediator : Mediating from ContinuationState");
    }

    boolean result;
    int subBranch = ((ReliantContinuationState) continuationState).getSubBranch();

    if (subBranch == 0) {
      // Default flow
      TemplateMediator templateMediator =
          (TemplateMediator) synCtx.getSequenceTemplate(targetTemplate);

      if (!continuationState.hasChild()) {
        result = templateMediator.mediate(synCtx, continuationState.getPosition() + 1);
        if (result) {
          templateMediator.popFuncContextFrom(synCtx);
        }
      } else {
        FlowContinuableMediator mediator =
            (FlowContinuableMediator) templateMediator.getChild(continuationState.getPosition());
        result = mediator.mediate(synCtx, continuationState.getChildContState());
      }
    } else {
      // Pre fetching invoke mediator flow
      String prefetchInvokeKey = key.evaluateValue(synCtx);
      InvokeMediator prefetchInvoke =
          (InvokeMediator) synCtx.getDefaultConfiguration(prefetchInvokeKey);

      ContinuationState childContinuationState = continuationState.getChildContState();
      result = prefetchInvoke.mediate(synCtx, childContinuationState);

      if (result && !childContinuationState.hasChild()) {
        // Pre fetching invoke mediator flow completed.
        // Remove ContinuationState represent the prefetchInvoke mediator and
        // flip the subbranch to default flow
        continuationState.removeLeafChild();
        ((ReliantContinuationState) continuationState).setSubBranch(0);
        // after prefetch invoke mediator flow, execute default flow
        result = mediate(synCtx, false);
      }
    }
    return result;
  }
Пример #3
0
  public boolean mediate(MessageContext synCtx, ContinuationState contState) {
    SynapseLog synLog = getLog(synCtx);

    if (synLog.isTraceOrDebugEnabled()) {
      synLog.traceOrDebug("Aggregate mediator : Mediating from ContinuationState");
    }

    boolean result;

    if (!contState.hasChild()) {
      result = getOnCompleteSequence().mediate(synCtx, contState.getPosition() + 1);
    } else {
      FlowContinuableMediator mediator =
          (FlowContinuableMediator) getOnCompleteSequence().getChild(contState.getPosition());
      result = mediator.mediate(synCtx, contState.getChildContState());
    }
    return result;
  }
Пример #4
0
  public boolean mediate(MessageContext synCtx, ContinuationState continuationState) {
    SynapseLog synLog = getLog(synCtx);

    if (synLog.isTraceOrDebugEnabled()) {
      synLog.traceOrDebug("Clone mediator : Mediating from ContinuationState");
    }

    boolean result;
    int subBranch = ((ReliantContinuationState) continuationState).getSubBranch();

    if (!continuationState.hasChild()) {
      result =
          targets.get(subBranch).getSequence().mediate(synCtx, continuationState.getPosition() + 1);
    } else {
      FlowContinuableMediator mediator =
          (FlowContinuableMediator)
              targets.get(subBranch).getSequence().getChild(continuationState.getPosition());
      result = mediator.mediate(synCtx, continuationState.getChildContState());
    }
    return result;
  }