4 Replies Latest reply on Mar 8, 2011 8:10 AM by davsclaus

    injection not working properly

    atlantix

      my camel-context.xml is as follow

       

            

         

       

       

      when I comment out the bean section the PaymentsProcessor route  is working properly and obviously the xmlPaymentProcessor is NULL

      when I uncomment that section which is actually what I want , I have the reference to my bean not NULL though the route doesnt working

       

       

       

      here is my code for PaymentsProcessor.java

       

      public class PaymentsProcessor extends RouteBuilder implements Bundle, DisposableBean, InitializingBean{

       

      private PaymentsApi processorApi;

      public PaymentsApi getProcessorApi() {

      return processorApi;

      }

      public void setProcessorApi(PaymentsApi processorApi) {

      this.processorApi = processorApi;

      }

       

      public void configure() throws Exception {

       

      // TODO Auto-generated method stub

      from("activemq:queue:PendingTransfers")

      .convertBodyTo(String.class)

       

      .process(new Processor() {

      public void process(Exchange exchange) throws Exception {

       

      String xml = (String) exchange.getIn().getBody();

      // ................. whatever code here

       

      logger.debug("============= processorApi.transferFunds(from, to, amount) =============== ");

      String status = processorApi.transferFunds(from, to, amount);

      exchange.getOut().setBody(output);

      }

      }).to("file://C:/outbox/done");

       

      }

       

       

       

       

       

      -


      my environment is the following

       

      karaf@root> version

      Major                2

      Minor                1

      Micro                3

      Qualifier            fuse-00-00

       

      karaf@root> features:list |grep -v unin

      State         Version                Name                                 Repository

      installed  http://5.4.2-fuse-01-00    activemq                             activemq-5.4.2-fuse-01-00

      installed  http://5.4.2-fuse-01-00    activemq-blueprint                   activemq-5.4.2-fuse-01-00

      installed  http://2.3.2-fuse-00-00    cxf                                  repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-shared                    repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-cxf-bc                    repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-file                      repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-ftp                       repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-http                      repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-jms                       repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-mail                      repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-bean                      repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-camel                     repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-drools                    repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-cxf-se                    repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-eip                       repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-osworkflow                repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-quartz                    repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-scripting                 repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-validation                repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-saxon                     repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-wsn2005                   repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-snmp                      repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-vfs                       repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-smpp                      repo-0

      installed  http://2011.01.0-fuse-00-00 servicemix-exec                      repo-0

      installed  http://4.3.1-fuse-00-00    activemq-broker                      repo-0

      installed  http://1.4.0-fuse-00-00    naming                               repo-0

      installed  http://0.2-incubating      transaction                          repo-0

      installed  http://1.4.0-fuse-00-00    document                             repo-0

      installed  http://1.4.0-fuse-00-00    nmr                                  repo-0

      installed  http://4.0.8               woodstox                             repo-0

      installed  http://1.4.0-fuse-00-00    jbi                                  repo-0

      installed  http://1.4.0-fuse-00-00    jbi-cluster                          repo-0

      installed  http://3.0.5.RELEASE       spring                               karaf-2.1.3-fuse-00-00

      installed  http://1.2.0               spring-dm                            karaf-2.1.3-fuse-00-00

      installed  http://2.1.3-fuse-00-00    config                               karaf-2.1.3-fuse-00-00

      installed  http://2.1.3-fuse-00-00    http                                 karaf-2.1.3-fuse-00-00

      installed  http://2.1.3-fuse-00-00    war                                  karaf-2.1.3-fuse-00-00

      installed  http://2.6.0-fuse-00-00    camel                                repo-0

      installed  http://2.6.0-fuse-00-00    camel-core                           repo-0

      installed  http://2.6.0-fuse-00-00    camel-spring                         repo-0

      installed  http://2.6.0-fuse-00-00    camel-blueprint                      repo-0

      installed  http://2.6.0-fuse-00-00    camel-jms                            repo-0

       

      Edited by: atlantix on Mar 7, 2011 11:16 AM

        • 1. Re: injection not working properly
          davsclaus

          Is this

          <spring-osgi:reference id="paymentsApiService" bean-name="paymentsApi"

          interface="ex.tuto.payments.payments_api.PaymentsApi"/>

           

          From another bundle?

           

          And have you installed and started that bundle before the Camel bundle?

          • 2. Re: injection not working properly
            davsclaus

            I assume you are using Fuse ESB 4.3.1-fuse-00-00. If not please details which version you are using.

             

            And when you say "route not working". What do you mean? eg what doesn't work.

            And can you see something in the logs?

            • 3. Re: injection not working properly
              atlantix

              oh by the way I fixed it yesterday

               

              it seems that the package scan is not enough to run my Route

               

                 

               

               

              Thanks

              • 4. Re: injection not working properly
                davsclaus

                Ah yeah that could be the case as package scan would instantiate the bean. Where as routeBuilderRef refers to an existing bean.

                 

                I will have to double check if package scan can leverage the IoC container to instantiate and do all the bean post processing, so it would work just as routeBuilderRef.