public MuleContext getMuleContext() { return event.getMuleContext(); }
private ServerNotificationHandler getNotificationHandler(MuleEvent event) { return serverNotificationHandlers.getUnchecked(event.getMuleContext()); } }
/** * Returns a {@link NestedProcessor} that wraps the {@code event} * * @param event a {@link MuleEvent} * @return a {@link NestedProcessor} * @throws MuleException */ @Override public NestedProcessor resolve(MuleEvent event) throws MuleException { return new NestedProcessorChain(event, event.getMuleContext(), messageProcessor); }
private MuleEvent routeWithProcessors(Collection<MessageProcessor> processors, MuleEvent event) throws MuleException { List<MuleEvent> results = new ArrayList<MuleEvent>(); for (MessageProcessor processor : processors) { processEventWithProcessor(event, processor, results); } return resultsHandler.aggregateResults(results, event, event.getMuleContext()); }
@Override public MuleEvent handleException(Exception exception, MuleEvent event) { event.getMuleContext().getExceptionListener().handleException(exception); return event; } }
public DefaultMuleEventContext(MuleEvent event) { this.event = event; this.session = event.getSession(); this.muleContext = event.getMuleContext(); this.clientInterface = muleContext.getClient(); }
/** * Returns the registry value associated with {@link #key} * * @param event a {@link MuleEvent} * @return the registry value associated with {@link #key} * @throws Exception */ @Override public T resolve(MuleEvent event) throws MuleException { return event.getMuleContext().getRegistry().get(key); }
protected String getValueForEvent(MuleEvent event) throws MessagingException { return event.getMuleContext().getExpressionManager().parse(valueExpression, event, true); }
protected String getIdForEvent(MuleEvent event) throws MessagingException { return event.getMuleContext().getExpressionManager().parse(idExpression, event, true); }
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); }
/** * This will send an event via the configured outbound router on the service * * @param message the message to send * @return the result of the send if any * @throws org.mule.api.MuleException if there is no outbound endpoint configured * on the service or the events fails during dispatch */ public MuleMessage sendEvent(Object message) throws MuleException { return sendEvent(new DefaultMuleMessage(message, event.getMessage(), event.getMuleContext())); }
public String get(final MuleEvent event) { final String resolvedWsAddress = event.getMuleContext() .getExpressionManager() .parse(wsAddress, event, true); return makeWsdlOrXSDAddress(resolvedWsAddress, event.getMessage()); } };
protected MuleEvent doProcess(MuleEvent event) throws MuleException { if (event.getMuleContext() != null && event.getMuleContext().getConfiguration().isFlowEndingWithOneWayEndpointReturnsNull()) { return doProcessFlowEndingWithOneWayEndpointReturnsNull(event); } else { return new ProcessorExecutorFactory().createProcessorExecutor(event, processors, messageProcessorExecutionTemplate, true).execute(); } }
protected MuleEvent aggregateWithoutFailedRoutes(AggregationContext context) throws MuleException { return this.resultsHandler.aggregateResults(context.getEvents(), context.getOriginalEvent(), context.getOriginalEvent().getMuleContext()); }
public WebServiceSecurityException(MuleEvent event, Throwable cause, MessageProcessor failingMessageProcessor) { super(MessageFactory.createStaticMessage( "Security exception occurred invoking web service\nEndpoint = " + event.getMessageSourceURI() + "\nSecurity provider(s) = " + event.getMuleContext().getSecurityManager().getProviders() + "\nEvent = " + event), event, cause, failingMessageProcessor); } }
public Object call() throws Exception { MuleMessage muleMessage = new DefaultMuleMessage(message, event.getMessage(), event.getMuleContext()); muleMessage.setOutboundProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, timeout); return sendEvent(muleMessage); } };
protected Authentication getAuthenticationToken(MuleEvent event) throws UnauthorisedException { ExpressionManager expressionManager = event.getMuleContext().getExpressionManager(); Object usernameEval = expressionManager.evaluate(username, event); Object passwordEval = expressionManager.evaluate(password, event); if (usernameEval == null) { throw new UnauthorisedException(CoreMessages.authNoCredentials()); } if (passwordEval == null) { throw new UnauthorisedException(CoreMessages.authNoCredentials()); } return new DefaultMuleAuthentication(new MuleCredentials(usernameEval.toString(), passwordEval.toString().toCharArray())); }
@Override public MuleEvent process(MuleEvent event) throws MuleException { FlowTraceManager flowTraceManager = event.getMuleContext().getFlowTraceManager(); flowTraceManager.onFlowStart(event, getSubFlowName()); try { return super.process(event); } finally { flowTraceManager.onFlowComplete(event); } }
@Operation public void customValidator(@ParameterGroup ObjectSource<Validator> source, @ParameterGroup ValidationOptions options, MuleEvent event, @UseConfig ValidationExtension config) throws Exception { ValidatorSource validatorSource = new ValidatorSource(source.getType(), source.getRef()); Validator validator = validatorSource.getObject(event.getMuleContext()); event.getMuleContext().getRegistry().applyProcessors(validator); validateWith(validator, createContext(options, event, config), event); }
private ValidationResult evaluateCustomMessage(ValidationResult result, ValidationContext validationContext) { String customMessage = validationContext.getOptions().getMessage(); if (!StringUtils.isBlank(customMessage)) { result = error(validationContext.getMuleEvent().getMuleContext().getExpressionManager().parse(customMessage, validationContext.getMuleEvent())); } return result; }