@Override protected boolean matchesSafely(FlowStackElement flowStackElement) { return flowStackElement.getFlowName().startsWith(flowName) && (executingMessageProcessor == null ? flowStackElement.getProcessorPath() == null : flowStackElement.getProcessorPath().startsWith(executingMessageProcessor + " @")); }
/** * Adds a message processor path to the list of processors that were invoked as part of the processing of this stack's event. * * @param processorPath the path to mark as invoked. * @throws EmptyStackException if this stack is empty. */ public void setCurrentProcessorPath(String processorPath) { if (!innerStack.empty()) { FlowStackElement topElement = innerStack.pop(); innerStack.push(new FlowStackElement(topElement.getFlowName(), processorPath)); } }
private Consumer<CoreEvent> pushSubFlowFlowStackElement() { return event -> ((DefaultFlowCallStack) event.getFlowCallStack()).push(new FlowStackElement(subFlowName, null)); }
@Override public String toString() { StringBuilder stackString = new StringBuilder(); for (int i = innerStack.size() - 1; i >= 0; --i) { stackString.append("at ").append(innerStack.get(i).toString()); if (i != 0) { stackString.append(System.lineSeparator()); } } return stackString.toString(); } }
@Override public void onFlowStart(EnrichedNotificationInfo notificationInfo, String flowName) { FlowCallStack flowCallStack = ((CoreEvent) notificationInfo.getEvent()).getFlowCallStack(); if (flowCallStack instanceof DefaultFlowCallStack) { ((DefaultFlowCallStack) flowCallStack).push(new FlowStackElement(flowName, null)); } }
private Consumer<CoreEvent> pushBeforeNextFlowStackElement() { return event -> ((DefaultFlowCallStack) event.getFlowCallStack()) .push(new FlowStackElement(getLocation().getLocation() + "[before next]", null)); }
private Consumer<CoreEvent> pushAfterNextFlowStackElement() { return event -> ((DefaultFlowCallStack) event.getFlowCallStack()) .push(new FlowStackElement(toPolicyLocation(getLocation()), null)); }
/** * Given an {@code event}, it will consume from it ONLY the defined properties and parameters that were set when initializing * this class to provide scoping for the inner list of processors. */ @Override public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { return from(publisher) .doOnNext(event -> ((DefaultFlowCallStack) event.getFlowCallStack()) .push(new FlowStackElement(getLocation().getRootContainerName(), getLocation().getLocation()))) .concatMap(request -> from(processWithChildContext(createEventWithParameters(request), super::apply, ofNullable(getLocation()))) .onErrorResume(MessagingException.class, createErrorResumeMapper(request)) .map(eventResult -> processResult(request, eventResult))) .doOnNext(event -> ((DefaultFlowCallStack) event.getFlowCallStack()).pop()) .doOnError(MessagingException.class, me -> ((DefaultFlowCallStack) me.getEvent().getFlowCallStack()).pop()); }