public boolean isStopped() { return muleContext!=null && !muleContext.isStarted(); }
/** * Initialises a default {@link MuleContext} for use by the client. * * @param startManager start the Mule context if it has not yet been initialised * @throws MuleException */ private void init(boolean startManager) throws MuleException { if (muleContext == null) { logger.info("No existing ManagementContext found, creating a new Mule instance"); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setClientMode(true); contextBuilder.setMuleConfiguration(config); muleContext = muleContextFactory.createMuleContext(contextBuilder); } else { logger.info("Using existing MuleContext: " + muleContext); } if (!muleContext.isStarted() && startManager == true) { logger.info("Starting Mule..."); muleContext.start(); } }
protected void doStart() throws MuleException { // Component is not in chain startIfStartable(exceptionListener); startIfStartable(component); startIfStartable(messageProcessorChain); if (muleContext.isStarted()) { startIfStartable(messageSource); } if (asyncReplyMessageSource.getEndpoints().size() > 0) { asyncReplyMessageSource.start(); } }
@Override protected void doStart() throws MuleException { super.doStart(); startIfStartable(pipeline); canProcessMessage = true; if (muleContext.isStarted()) { try { startIfStartable(messageSource); } // Let connection exceptions bubble up to trigger the reconnection strategy. catch (ConnectException ce) { throw ce; } catch (MuleException e) { // If the messageSource couldn't be started we would need to stop the pipeline (if possible) in order to leave // its LifecycleManager also as initialise phase so the flow can be disposed later doStop(); throw e; } } }