@Override public ServerNotificationHandler load(MuleContext muleContext) throws Exception { return adaptNotificationHandler(muleContext.getNotificationManager()); } });
public void setMuleContext(MuleContext context) { this.muleContext = context; notificationHandler = muleContext.getNotificationManager(); }
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof ServerNotificationListener) { if (!muleContext.getNotificationManager().isListenerRegistered((ServerNotificationListener) bean)) { muleContext.getNotificationManager().addListener((ServerNotificationListener) bean); } } return bean; }
protected void updateCachedNotificationHandler() { if (null != muleContext) { notificationHelper = new NotificationHelper(muleContext.getNotificationManager(), EndpointMessageNotification.class, dynamicNotification); } }
protected void removeNotificationListeners() { muleContext.getNotificationManager().removeListener(messageProcessorTextDebugger); muleContext.getNotificationManager().removeListener(pipelineProcessorDebugger); }
public Object process(Object object) { if (object instanceof ServerNotificationListener) { context.getNotificationManager().addListener((ServerNotificationListener) object); } return object; } }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof ServerNotificationListener) { muleContext.getNotificationManager().addListener((ServerNotificationListener) bean); } return bean; }
public void onTransition(String phaseName, Component object) throws MuleException { notificationHandler = new OptimisedNotificationHandler(muleContext.getNotificationManager(), ComponentMessageNotification.class); doStart(); } });
@Override protected void processFinally(MuleEvent event, MessagingException exception) { muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_END)); } }
@Override public MuleEvent process(MuleEvent event) throws MuleException { muleContext.getNotificationManager().fireNotification( new PipelineMessageNotification(AbstractPipeline.this, event, PipelineMessageNotification.PROCESS_END)); return event; } });
protected void handleNotificationListeners() { if (DefaultMuleConfiguration.isFlowTrace()) { muleContext.getNotificationManager().addListener(messageProcessorTextDebugger); muleContext.getNotificationManager().addListener(pipelineProcessorDebugger); } else { removeNotificationListeners(); } }
@Override protected void processFinally(MuleEvent event, MessagingException exception) { muleContext.getNotificationManager().fireNotification( new PipelineMessageNotification(AbstractPipeline.this, event, PipelineMessageNotification.PROCESS_COMPLETE, exception)); } });
@Override protected MuleEvent processRequest(MuleEvent event) throws MuleException { muleContext.getNotificationManager().fireNotification( new PipelineMessageNotification(AbstractPipeline.this, event, PipelineMessageNotification.PROCESS_START)); return super.processRequest(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)); } }
public MuleContext createMuleContext() throws Exception { performActionsBeforeCreation(); List<ConfigurationBuilder> builders = getConfigurationBuilderList(); // Create context builder MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); configureMuleContextBuilder(contextBuilder); // Create context MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); MuleContext context = muleContextFactory.createMuleContext(builders, contextBuilder); ((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(0); // register notification listeners context.getNotificationManager().setNotificationDynamic(true); context.getNotificationManager().addInterfaceToType(MessageProcessorNotificationListener.class, MessageProcessorNotification.class); performActionsAfterCreation(context); return context; }
public MuleContext createMule(String resources) throws Exception { actionsToRunBeforeMuleContextCreation(); defineLogOutput(resources); List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>(); builders.add(new SimpleConfigurationBuilder(getStartUpProperties())); builders.add(new ExtensionsManagerConfigurationBuilder()); addIfPresent(builders, CLASSNAME_ANNOTATIONS_CONFIG_BUILDER); builders.add(getBuilder(resources)); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); configureMuleContextBuilder(contextBuilder); MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); MuleContext context = muleContextFactory.createMuleContext(builders, contextBuilder); ((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(0); context.getNotificationManager().setNotificationDynamic(true); context.getNotificationManager().addInterfaceToType(MessageProcessorNotificationListener.class, MessageProcessorNotification.class); plugins = new MunitPluginFactory().loadPlugins(context); initialisePlugins(); return context; }
public MuleEvent handleException(Exception ex, MuleEvent event) { try { muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_START)); //keep legacy notifications fireNotification(ex); // Work with the root exception, not anything that wraps it //Throwable t = ExceptionHelper.getRootException(ex); logException(ex, event); doHandleException(ex, event); ExceptionPayload exceptionPayload = new DefaultExceptionPayload(ex); if (RequestContext.getEvent() != null) { RequestContext.setExceptionPayload(exceptionPayload); } event.getMessage().setPayload(NullPayload.getInstance()); event.getMessage().setExceptionPayload(exceptionPayload); return event; } finally { muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(event, ExceptionStrategyNotification.PROCESS_END)); } }
@Override protected MuleEvent processRequest(MuleEvent request) throws MuleException { if (!handleException && request.getReplyToHandler() instanceof NonBlockingReplyToHandler) { request = new DefaultMuleEvent(request, request.getFlowConstruct(), null, null, true); } muleContext.getNotificationManager().fireNotification(new ExceptionStrategyNotification(request, ExceptionStrategyNotification.PROCESS_START)); fireNotification(exception); logException(exception, request); processStatistics(request); request.getMessage().setExceptionPayload(new DefaultExceptionPayload(exception)); markExceptionAsHandledIfRequired(exception); return beforeRouting(exception, request); }
@Override public void initialise() throws InitialisationException { if (requestConfig == null) { throw new InitialisationException(createStaticMessage("The config-ref attribute is required in the HTTP request element"), this); } if (requestBuilder == null) { requestBuilder = new HttpRequesterRequestBuilder(); } LifecycleUtils.initialiseIfNeeded(requestBuilder); setEmptyAttributesFromConfig(); validateRequiredProperties(); basePath = new AttributeEvaluator(requestConfig.getBasePath()); muleEventToHttpRequest = new MuleEventToHttpRequest(this, muleContext, requestStreamingMode, sendBodyMode); httpResponseToMuleEvent = new HttpResponseToMuleEvent(this, muleContext, parseResponse); initializeAttributeEvaluators(host, port, method, path, basePath, url, followRedirects, requestStreamingMode, sendBodyMode, parseResponse, responseTimeout); notificationHelper = new NotificationHelper(muleContext.getNotificationManager(), ConnectorMessageNotification.class, false ); }