camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S. Ali Tokmen" <>
Subject Registry/Repository support in CAMEL
Date Mon, 01 Dec 2008 15:25:03 GMT

I've been doing a lot of CAMEL-related architecture reading, code 
analysing and debugging these days and finally came up with a Registry 
which is kind of working. Here's how I proceed, any remarks are of 
course welcome:

   1. The registry works this way:
          * What I call "registry" is simply a mapping between keys and
          * Keys represent logical names, for example "loginWebService"
          * Values represent technical names, for example
          * The main method the registry has is "lookup", which returns
            the technical name for the given logical name
   2. The CAMEL component doing lookups on that registry is the
      following class:

      public class RegistryComponent implements Component<Exchange> {

      [getters, setters, ...]

          public Endpoint<Exchange> createEndpoint(String name) throws
      Exception {
              *// Name is registry:logicalName. Only keep the logicalName*
              String logicalName = name.substring(0, name.indexOf(':') + 1);
              *// Look up for the logicalName*
              String technicalName = this.registry.lookup(logicalName);
              *// technicalName is scheme:path*
              *// For example jms:queue:myQueue has as scheme jms*
              String scheme = technicalName.substring(0,
              return context.getComponent(scheme).createEndpoint(name);
   3. Let's now assume we have:
          * A registry containing the following link: queue1 ->
          * The camel-context.xml file defining the following bean:
            <bean id="registry" class="test.RegistryComponent"/>
          * An endpoint with url: registry:queue1
   4. When CAMEL looks for the endpoint registry:queue1
         1. It automatically finds out that the registry protocol links
            with the RegistryComponent class (thanks to the
            configuration in camel-context.xml).
         2. Since the RegistryComponent class is a Component, CAMEL will
            always call its createEndpoint method:
                * name is "registry:queue1"
                * logicalName is "queue1"
                * technicalName for the logicalName "queue1" is
                * scheme is "jms"
                * context.getComponent("jms") will return the JMS component
                * createEndpoint will return the associated endpoint
                  (JMS Queue instance)
   5. When CAMEL looks for any endpoint that doesn't start with
      registry, the RegistryComponent is not used.

What do you think? Any comments?



S. Ali Tokmen

Office: +33 4 76 29 76 19
GSM:    +33 66 43 00 555

Bull, Architect of an Open World TM

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message