2 Replies Latest reply on May 11, 2015 8:01 AM by mlybarger

    pass context properties to camel route

    mlybarger

      I have a simple switchyard application. input from a file to a bean component to a camel route.  i would like the bean to be able to set a property which can be read by the camel route. sort of like a session property in the http servlet world.

      2015-05-08 16_37_59-JBoss - bar_src_main_resources_META-INF_switchyard.xml - JBoss Developer Studio.png

      The bean has code to get the context and set a property, but the route doesn't seem to have that:

       

      @Service(Example.class)

      public class ExampleBean implements Example {

       

       

        @Inject

        Context context;

       

        @Inject

        Exchange exchange;

       

        @Reference

        @Inject

        Ex ex;

       

        @Override

        public String message(String m) {

        Context c = exchange.getContext();

        c.setProperty("foo", "bar", Scope.EXCHANGE);

        ex.process(m);

        return null;

        }

       

       

      }

       

      This is not working. The camel route doesn't show the property on the exchange.  How can I add a property to be sent to the camel route?

       

      Thanks!

      -mark-