private static Map<MessageProcessor, String> buildPaths(MessageProcessorPathElement element, Map<MessageProcessor, String> elements) { if (element.getMessageProcessor() != null) { elements.put(element.getMessageProcessor(), element.getPath()); } List<MessageProcessorPathElement> children = element.getChildren(); for (MessageProcessorPathElement child : children) { buildPaths(child, elements); } return elements; }
public void addChild(MessageProcessorPathElement mp) { children.add(mp); mp.setParent(this); }
@Override public void addMessageProcessorPathElements(MessageProcessorPathElement pathElement) { if (messageProcessor instanceof MessageProcessorChain) { NotificationUtils.addMessageProcessorPathElements(((MessageProcessorChain) messageProcessor).getMessageProcessors(), pathElement.getParent()); } else if (messageProcessor != null) { NotificationUtils.addMessageProcessorPathElements(Arrays.asList(messageProcessor), pathElement.getParent()); } }
@Override public void addMessageProcessorPathElements(MessageProcessorPathElement pathElement) { int idx = 0; for (MessagingExceptionHandlerAcceptor listener : exceptionListeners) { if (listener instanceof MessageProcessorContainer) { MessageProcessorPathElement exceptionListener = pathElement.addChild(String.valueOf(idx)); ((MessageProcessorContainer) listener).addMessageProcessorPathElements(exceptionListener); } idx++; } }
/** * MULE-11358: since the ForEach does not wrapps its components in any wrapper if there is a filter inside of it, * wrapped with a MessageFilter, it would end duplicating the path elements for the filter and the message * processors that come after it. */ private boolean alreadyAddedChild(MessageProcessor messageProcessor) { if (messageProcessor == null) { return false; } for (MessageProcessorPathElement child : children) { if (messageProcessor.equals(child.getMessageProcessor())) { return true; } } return false; }
public String getPath() { return parent == null ? "/" + getName() : parent.getPath() + "/" + getName(); }
@Override public void addMessageProcessorPathElements(MessageProcessorPathElement pathElement) { if (next instanceof InternalMessageProcessor) { return; } if (next instanceof MessageProcessorChain) { NotificationUtils.addMessageProcessorPathElements(((MessageProcessorChain) next).getMessageProcessors(), pathElement.getParent()); } else if (next != null) { NotificationUtils.addMessageProcessorPathElements(Arrays.asList(next), pathElement.getParent()); } } }
@Override public void addMessageProcessorPathElements(MessageProcessorPathElement pathElement) { MessageProcessorPathElement subprocessors = pathElement.addChild(name).addChild("subprocessors"); //Only MP till first InterceptiongMessageProcessor should be used to generate the Path, // since the next ones will be generated by the InterceptingMessageProcessor because they are added as an inned chain List<MessageProcessor> filteredMessageProcessorList = new ArrayList<MessageProcessor>(); for (MessageProcessor messageProcessor : processors) { if (messageProcessor instanceof InterceptingMessageProcessor) { filteredMessageProcessorList.add(messageProcessor); break; } else { filteredMessageProcessorList.add(messageProcessor); } } NotificationUtils.addMessageProcessorPathElements(filteredMessageProcessorList, subprocessors); }
public static void addMessageProcessorPathElements(List<MessageProcessor> processors, MessageProcessorPathElement parentElement) { if (processors == null || parentElement == null) { return; } for (MessageProcessor mp : processors) { if (!(mp instanceof InternalMessageProcessor)) { MessageProcessorPathElement messageProcessorPathElement; // To avoid adding a level in some path elements: if (mp instanceof InterceptingChainLifecycleWrapperPathSkip) { messageProcessorPathElement = parentElement; } else { messageProcessorPathElement = parentElement.addChild(mp); } if (messageProcessorPathElement != null && mp instanceof MessageProcessorContainer) { ((MessageProcessorContainer) mp).addMessageProcessorPathElements(messageProcessorPathElement); } } } }
String esPrefix = "es"; MessageProcessorPathElement processorPathElement = pathElement.addChild(processorsPrefix); if (esGlobalName != null) exceptionStrategyPathElement = exceptionStrategyPathElement.addChild(esGlobalName); exceptionStrategyPathElement = exceptionStrategyPathElement.addChild(esPrefix); ((MessageProcessorContainer) exceptionListener).addMessageProcessorPathElements(exceptionStrategyPathElement);