protected void startCamelContext() throws Exception {
   if (camelContextService != null) {
     camelContextService.start();
   } else {
     if (context instanceof DefaultCamelContext) {
       DefaultCamelContext defaultCamelContext = (DefaultCamelContext) context;
       if (!defaultCamelContext.isStarted()) {
         defaultCamelContext.start();
       }
     } else {
       context.start();
     }
   }
 }
 @Reference
 public void setConnectionFactory(ConnectionFactory connectionFactory) {
   try {
     rwl.writeLock().lock();
     if (camelContext == null) {
       LOG.info("Creating the Camel Context");
       camelContext = new DefaultCamelContext();
       LOG.info("Activating the SjmsComponent");
       SjmsComponent sjms = getConnectionFactoryInstance(connectionFactory);
       camelContext.addComponent("sjms", sjms);
       LOG.info("Starting the Camel Context");
       camelContext.start();
     }
   } catch (Exception e) {
     LOG.error("Error starting up the Camel Context", e);
   } finally {
     rwl.writeLock().unlock();
   }
 }
  @Override
  protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    // lets create our black box as a camel context and a set of routes
    DefaultCamelContext blackBox = new DefaultCamelContext(registry);
    blackBox.setName("blackBox");
    blackBox.addRoutes(
        new RouteBuilder() {
          @Override
          public void configure() throws Exception {
            // receive purchase orders, lets process it in some way then
            // send an invoice to our invoice endpoint
            from("direct:purchaseOrder")
                .setHeader("received")
                .constant("true")
                .to("direct:invoice");
          }
        });
    blackBox.start();

    registry.bind("accounts", blackBox);
    return registry;
  }
 public void start() throws Exception {
   DefaultCamelContext context = new DefaultCamelContext();
   context.addRoutes(getRoute());
   addBeans(context);
   context.start();
 }