2 Replies Latest reply on Aug 19, 2013 1:37 PM by Keith Babo

    required interface?

    Jeannie Sorenson Newbie

      I take it that all registered components in a Switchyard composite require an interface, even for injected beans in a simple camel routing. Is this correct?


      If so, I understand this is probably the soa way, but it is a lot of overkill for a simple route where there is zero expectation of having to swap in a subsequent implementation. Any way to avoid it?

        • 1. Re: required interface?
          Jeannie Sorenson Newbie

          I think I might be able to answer my own question. If there is no need for reuse for the bean for other Switchyard services, a bean can be mapped with @Bean("beanName") and it can be therewith used. What might be spec-nonconformant is that if there is no explicit name in the @Bean annotation, that Camel does not recognize the class name as a bean name, but I am not sure.

          • 2. Re: required interface?
            Keith Babo Master

            If you want to invoke Java classes with no requirement for providing a service contract, then just use CDI beans.  You can invoke these directly from a Camel route by using @Named on the Java class you want to invoke and beanRef("YourBeanName") or to("bean://YourBeanName") in the route itself.