camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Whytock <dwhyt...@gmail.com>
Subject Re: Adding properties to an Exchange
Date Thu, 14 Jul 2011 17:53:26 GMT
Sorry...make that

http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/ProcessorDefinition.html#setProperty(java.lang.String,
org.apache.camel.Expression)

On Thu, Jul 14, 2011 at 1:51 PM, Donald Whytock <dwhytock@gmail.com> wrote:
> Actually, you don't need the Processor, if it's a relatively static
> value.  You can use
>
>  from().setProperty().to()
>
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/model/ProcessorDefinition.html#setProperty(java.lang.String)
>
> Don
>
> On Thu, Jul 14, 2011 at 1:41 PM, Jeff Segal <jeffrey.segal@gmail.com> wrote:
>> I'd like to know the best way to add domain-specific context information to
>> Exchanges linked to a particular RouteBuilder. Let's say that I have the
>> following:
>>
>> public class MyRouteBuilder extends RouteBuilder {
>>
>>    String someProperty;
>>
>>    @Override
>>    public void configure() throws Exception {
>>        from("direct:foo").to("bean:myBean");
>>    }
>>
>> }
>>
>> public class MyBean {
>>  public void handle(Exchange exchange) {
>> // Want to access 'someProperty' of MyRouteBuilder here
>> }
>> }
>>
>> One way that I believe would work here would be to add a Processor to the
>> Route which called exchange.setProperty(), then access it in MyBean via
>> exchange.getProperty(). However, I'm curious if there is an easier/more
>> preferred way of doing this.
>>
>> Thanks,
>> Jeff
>>
>

Mime
View raw message