@Test public void testCreateDispatcher() throws Exception { ServiceReference inOnly = new ServiceReferenceImpl( new QName("inOnly"), new InOnlyService(), _domain, null); assertNotNull(_provider.createDispatcher(inOnly)); ServiceReference inOut = new ServiceReferenceImpl( new QName("inOut"), new InOutService(), _domain, null); assertNotNull(_provider.createDispatcher(inOut)); }
@Override public ExchangeDispatcher createDispatcher(final ServiceReference reference) { if (_logger.isDebugEnabled()) { _logger.debug("Creating Camel dispatcher for " + reference.getName()); } String endpoint = "direct:" + reference.getName(); RouteBuilder rb = new CamelExchangeBusRouteBuilder(endpoint, reference); try { if (_camelContext.getRoute(endpoint) != null) { _camelContext.removeRoute(endpoint); if (_logger.isInfoEnabled()) { BusLogger.ROOT_LOGGER.removeRoute(endpoint); } } _camelContext.addRoutes(rb); if (_logger.isDebugEnabled()) { _logger.debug("Created route for " + endpoint + ", definition is: " + ModelHelper.dumpModelAsXml(rb.getRouteCollection())); } } catch (Exception ex) { throw BusMessages.MESSAGES.failedToCreateRoute(reference.getName(), ex); } ExchangeDispatcher dispatcher = new ExchangeDispatcher(_camelContext, reference); _dispatchers.put(reference.getName(), dispatcher); return dispatcher; }
CamelExchangeBus implements ExchangeBus { @Override public ExchangeDispatcher createDispatcher(final ServiceReference reference) { if (_logger.isDebugEnabled()) { _logger.debug("Creating Camel dispatcher for " + reference.getName()); } String endpoint = "direct:" + reference.getName(); RouteBuilder rb = new CamelExchangeBusRouteBuilder(endpoint, reference); try { if (_camelContext.getRoute(endpoint) != null) { _camelContext.removeRoute(endpoint); if (_logger.isInfoEnabled()) { BusLogger.ROOT_LOGGER.removeRoute(endpoint); } } _camelContext.addRoutes(rb); if (_logger.isDebugEnabled()) { _logger.debug("Created route for " + endpoint + ", definition is: " + ModelHelper.dumpModelAsXml(rb.getRouteCollection())); } } catch (Exception ex) { throw BusMessages.MESSAGES.failedToCreateRoute(reference.getName(), ex); } ExchangeDispatcher dispatcher = new ExchangeDispatcher(_camelContext, reference); _dispatchers.put(reference.getName(), dispatcher); return dispatcher; } }
CamelExchangeBus implements ExchangeBus { @Override public ExchangeDispatcher createDispatcher(final ServiceReference reference) { if (_logger.isDebugEnabled()) { _logger.debug("Creating Camel dispatcher for " + reference.getName()); } String endpoint = "direct:" + reference.getName(); RouteBuilder rb = new CamelExchangeBusRouteBuilder(endpoint, reference); try { if (_camelContext.getRoute(endpoint) != null) { _camelContext.removeRoute(endpoint); if (_logger.isInfoEnabled()) { BusLogger.ROOT_LOGGER.removeRoute(endpoint); } } _camelContext.addRoutes(rb); if (_logger.isDebugEnabled()) { _logger.debug("Created route for " + endpoint + ", definition is: " + ModelHelper.dumpModelAsXml(rb.getRouteCollection())); } } catch (Exception ex) { throw BusMessages.MESSAGES.failedToCreateRoute(reference.getName(), ex); } ExchangeDispatcher dispatcher = new ExchangeDispatcher(_camelContext, reference); _dispatchers.put(reference.getName(), dispatcher); return dispatcher; } CamelExchangeBus(SwitchYardCamelContext context); }
CamelExchangeBus implements ExchangeBus { @Override public ExchangeDispatcher createDispatcher(final ServiceReference reference) { if (_logger.isDebugEnabled()) { _logger.debug("Creating Camel dispatcher for " + reference.getName()); } String endpoint = "direct:" + reference.getName(); RouteBuilder rb = new CamelExchangeBusRouteBuilder(endpoint, reference); try { if (_camelContext.getRoute(endpoint) != null) { _camelContext.removeRoute(endpoint); if (_logger.isInfoEnabled()) { BusLogger.ROOT_LOGGER.removeRoute(endpoint); } } _camelContext.addRoutes(rb); if (_logger.isDebugEnabled()) { _logger.debug("Created route for " + endpoint + ", definition is: " + ModelHelper.dumpModelAsXml(rb.getRouteCollection())); } } catch (Exception ex) { throw BusMessages.MESSAGES.failedToCreateRoute(reference.getName(), ex); } ExchangeDispatcher dispatcher = new ExchangeDispatcher(_camelContext, reference); _dispatchers.put(reference.getName(), dispatcher); return dispatcher; } CamelExchangeBus(SwitchYardCamelContext context); @Override void init(ServiceDomain domain); @Override synchronized void start(); @Override synchronized void stop(); @Override Dispatcher getDispatcher(ServiceReference reference); @Override ExchangeDispatcher createDispatcher(final ServiceReference reference); }
CamelExchangeBus implements ExchangeBus { @Override public ExchangeDispatcher createDispatcher(final ServiceReference reference) { if (_logger.isDebugEnabled()) { _logger.debug("Creating Camel dispatcher for " + reference.getName()); } String endpoint = "direct:" + reference.getName(); RouteBuilder rb = new CamelExchangeBusRouteBuilder(endpoint, reference); try { if (_camelContext.getRoute(endpoint) != null) { _camelContext.removeRoute(endpoint); if (_logger.isInfoEnabled()) { BusLogger.ROOT_LOGGER.removeRoute(endpoint); } } _camelContext.addRoutes(rb); if (_logger.isDebugEnabled()) { _logger.debug("Created route for " + endpoint + ", definition is: " + ModelHelper.dumpModelAsXml(rb.getRouteCollection())); } } catch (Exception ex) { throw BusMessages.MESSAGES.failedToCreateRoute(reference.getName(), ex); } ExchangeDispatcher dispatcher = new ExchangeDispatcher(_camelContext, reference); _dispatchers.put(reference.getName(), dispatcher); return dispatcher; } CamelExchangeBus(SwitchYardCamelContext context); @Override void init(ServiceDomain domain); @Override synchronized void start(); @Override synchronized void stop(); @Override Dispatcher getDispatcher(ServiceReference reference); @Override ExchangeDispatcher createDispatcher(final ServiceReference reference);  }