3 Replies Latest reply on Apr 27, 2011 9:17 PM by kcbabo

    Exchange creation

    beve

      Lets say that I only have the QName of a service, is there a way to create an Exchange with only this information?

      The only way that I know about is using a ServiceReference:

       

      Exchange createExchange(ExchangeContract contract);
      Exchange createExchange(ExchangeContract contract, ExchangeHandler handler);
      

       

      Or is there perhaps a way to lookup a ServiceReference for a QName?

      The code where I'm trying to do this (Camel Component classes) does not have access to the Domain, otherwise I could look it up using Domain.getService(QName).

       

      Any suggestion in alternative ways?

       

      Thanks,

       

      /Daniel

        • 1. Exchange creation
          kcbabo

          Right now, you need access to the domain to get a ServiceReference based on name.  I'm not necessarily against providing a facility for ServiceReference lookup, but I would like to understand the use case behind it.  Do you have a requirement for sending ad hoc exchanges to services that are not specifically declared as references in an application? 

           

          As background, we went with the current API to force references to be explicitly declared to prevent undeclared references from cropping up and introducing hidden dependencies.  That said, there are probably cases where a component needs access to a service which may not be relevant to the application (e.g. a control or management service), so I'm happy to hear about any use cases which challenge our initial assumption. :-)

          • 2. Re: Exchange creation
            beve

            Sorry for the late reply...I must have missed the email, or the notification is acting up...

            Do you have a requirement for sending ad hoc exchanges to services that are not specifically declared as references in an application?

            I'm currently looking at refactoring the Camel component and it would be more straight forward if there was a way to look up a ServiceReference using some sort of registry. What I'm doing at the moment is when the CamelActivator's start method is called, the ServiceReference passed into the start method is added to ServiceReferences . This way the SwitchYardProducer can look up the ServiceReference.

             

            As background, we went with the current API to force references to be explicitly declared to prevent undeclared references from cropping up and introducing hidden dependencies.

            Ah right, that makes sense. Perhaps the solution above is alright for the Camel component. The refs would still have to be declared in explicitely in the configuration. What do you think?

             

            /Dan

            • 3. Exchange creation
              kcbabo

              We need something like a ServiceReferences, but preferably something that keeps domains separated.  I think we should be able to provide a ServiceLookup type of deal that hides the association with the current domain behind the scenes.  We can hack something up next week.