/** * Copy constructor used when ReplyToHandler instance needs switching out * * @param rewriteEvent * @param replyToHandler */ public DefaultMuleEvent(MuleEvent rewriteEvent, ReplyToHandler replyToHandler) { this(rewriteEvent, rewriteEvent.getFlowConstruct(), replyToHandler, null); }
/** * @return the service descriptor of the service that received this event */ public FlowConstruct getFlowConstruct() { return event.getFlowConstruct(); }
protected String getProcessorPath(MuleEvent event, MessageProcessor lastProcessed) { if (event.getFlowConstruct() != null && event.getFlowConstruct() instanceof MessageProcessorPathResolver) { return ((MessageProcessorPathResolver) event.getFlowConstruct()).getProcessorPath(lastProcessed); } else { return lastProcessed.toString(); } } }
public ExceptionStrategyNotification(Object message, int action) { super(message, action); if (message instanceof MuleEvent) { resourceIdentifier = ((MuleEvent) message).getFlowConstruct().getName(); } } }
@Override public MuleEvent after(MuleEvent event) { if (logger.isDebugEnabled() && event != null) { logger.debug("Finished event processing for " + event.getFlowConstruct().getName()); } return event; }
@Override public MuleEvent before(MuleEvent event) { if (logger.isDebugEnabled()) { logger.debug("Started event processing for " + event.getFlowConstruct().getName()); } return event; }
protected void fireAsyncScheduledNotification(MuleEvent event) { if (event.getFlowConstruct() instanceof MessageProcessorPathResolver) { muleContext.getNotificationManager().fireNotification( new AsyncMessageNotification(event.getFlowConstruct(), event, next, AsyncMessageNotification.PROCESS_ASYNC_SCHEDULED)); } }
protected void firePipelineNotification(MuleEvent event, MessagingException exception) { // Async completed notification uses same event instance as async listener if (event.getFlowConstruct() instanceof MessageProcessorPathResolver) { muleContext.getNotificationManager().fireNotification( new AsyncMessageNotification(event.getFlowConstruct(), event, next, AsyncMessageNotification.PROCESS_ASYNC_COMPLETE, exception)); } }
final public MuleEvent handleException(Exception exception, MuleEvent event) { try { return new ExceptionMessageProcessor(exception, muleContext, event.getFlowConstruct()).process(event); } catch (MuleException e) { throw new RuntimeException(e); } }
@Override public void processReplyTo(MuleEvent result, MuleMessage returnMessage, Object replyTo) throws MuleException { if (fireNotification) { fireNotification(notificationManager, event.getFlowConstruct(), result != null ? result : event, messageProcessor, null, MessageProcessorNotification.MESSAGE_PROCESSOR_POST_INVOKE); } originalReplyToHandler.processReplyTo(result, returnMessage, replyTo); }
public String getProcessorPath() { FlowConstruct fc = getSource().getFlowConstruct(); if (!(fc instanceof MessageProcessorPathResolver)) { return null; } return ((MessageProcessorPathResolver) fc).getProcessorPath(processor); } }
public static Serializable buildQueueKey(final MuleEvent muleEvent) { // the key is built in way to prevent UntilSuccessful workers across a // cluster to compete for the same // events over a shared object store // it also adds a random trailer to support events which have been // split and thus have the same id. Random number was chosen over // UUID for performance reasons String key = String.format("%s-%s-%s-%d", muleEvent.getFlowConstruct(), muleEvent.getMuleContext().getClusterId(), muleEvent.getId(), random.nextInt()); return new QueueKey(QueuePersistenceObjectStore.DEFAULT_QUEUE_STORE, key); }
@Override protected boolean shouldProcessEvent(MuleEvent event) { // Only process ReplyToHandler is running one-way and standard ReplyToHandler is being used. return !event.getExchangePattern().hasResponse() && (event.getFlowConstruct() instanceof Flow) && event .getReplyToHandler() instanceof DefaultReplyToHandler; }
private void processStatistics(MuleEvent event) { FlowConstructStatistics statistics = event.getFlowConstruct().getStatistics(); if (statistics != null && statistics.isEnabled()) { statistics.incExecutionError(); } }
public DefaultMuleEvent(MuleMessage message, MuleEvent rewriteEvent, boolean synchronus, boolean shareFlowVars) { this(message, rewriteEvent, rewriteEvent.getFlowConstruct(), rewriteEvent.getSession(), synchronus, shareFlowVars, rewriteEvent.getExchangePattern(), rewriteEvent.getReplyToHandler()); }
@Override public MuleEvent process() throws Exception { MuleEvent result = messageProcessorChain.process(newEvent); if (result != null && !VoidMuleEvent.getInstance().equals(result)) { result.getMessage().release(); return new DefaultMuleEvent(result, event.getFlowConstruct()); } return null; } });
protected DefaultMuleEvent(MuleMessage message, MuleEvent rewriteEvent, FlowConstruct flowConstruct, MuleSession session, boolean synchronous) { this(message, rewriteEvent, flowConstruct, session, synchronous, rewriteEvent.getReplyToHandler(), rewriteEvent.getReplyToDestination(), true, rewriteEvent.getExchangePattern()); }
private MuleEvent createReturnEventForParentFlowConstruct(MuleEvent result, MuleEvent original) { if (result != null && !(result instanceof VoidMuleEvent)) { // Create new event with original FlowConstruct, ReplyToHandler and synchronous result = new DefaultMuleEvent(result, original.getFlowConstruct(), original.getReplyToHandler(), original.getReplyToDestination(), original.isSynchronous()); } resetRequestContextEvent(result); return result; }
private boolean isNonBlocking(MuleEvent event) { return event.getFlowConstruct() instanceof Flow && event.isAllowNonBlocking() && event.getReplyToHandler() != null && isSupportsNonBlocking() && !endpoint.getTransactionConfig().isTransacted(); }
protected void setAsyncReplyProperties(MuleEvent event) throws MuleException { event.getMessage().setReplyTo(getReplyTo()); event.getMessage().setOutboundProperty(MuleProperties.MULE_REPLY_TO_REQUESTOR_PROPERTY, event.getFlowConstruct().getName()); String correlation = event.getFlowConstruct().getMessageInfoMapping().getCorrelationId( event.getMessage()); event.getMessage().setCorrelationId(correlation); }