1 Reply Latest reply on Aug 21, 2009 11:34 AM by Dave Stanley

    @Header annotation with bean component

    vector_jdev.work Newbie

      Is it possible to use @Header annotation to pass headers via spring xml to some deployed bean?

      I deployed the following xml in fuse:

       

      <osgi:reference id="sampleBean" interface="com.sample.SampleBeanInterface"/>

          <osgic:camelContext xmlns="http://activemq.apache.org/camel/schema/spring">

              <route>

                  <from uri="timer://myTimer?fixedRate=true&amp;period=10000"/>

                  <setBody>

                      <constant>bodyValue</constant>

                  </setBody>

                  <setHeader headerName="header1">

                      <constant>the value1</constant>

                  </setHeader>

                  <setHeader headerName="header2"> 

                      <constant>the value2</constant>

                  </setHeader>

                  <to uri="bean:sampleBean?method=go"/>

              </route>

          </osgic:camelContext>

       

       

      When using

      public void go(Exchange exchange);

      in sampleBean it works and I am able to get header1, header2 and body.

       

      When using

      public void go(@Body String body, @Header(name = "header1")String header1, @Header(name = "header2")String header2);

      in sampleBean it seems that camel can not find message destination at all.

      Is it possible to use @Body and @Header annotation when using bean endpoint from spring xml?

       

      Edited by: vector on Aug 21, 2009 12:08 PM