title: Apache Camel routing to an interface (or rather adding listeners dynamically)
body: <p>I am working on a simple use case that would allow clients to dynamically register for events from a JMS endpoint. My current implementation looks like this:</p>
  
  <pre><code>...
  public void addListener(Event event, Listener listener){
      try {
          camelContext.addRoutes(new RouteBuilder() {
              @Override
              public void configure() throws Exception {
                  from(event.from()).bean(listener);
              }
          });
      } catch (Exception exception) {
          exception.printStackTrace();
      }
  
  }
  ...
  </code></pre>
  
  <p>event.from() above would identify the endpoint from which the message would be consumed ("activemq:topic:market.stocks.update.ibm") and listener would be an implementation of the Listener interface.</p>
  
  <p>I had envisaged a typical invocation as:</p>
  
  <pre><code>notifications.addListener(updateEvent, new Listener(){
      void listen(){
          System.out.println("Hey! Something got updated");
      }
  });
  </code></pre>
  
  <p>Except, of course, none of the above works since the camel route expects to have a concrete bean as the recipient and hence camel context fails to start-up.</p>
  
  <p>What is the recommended way of adding bean end points dynamically?</p>