Hi,

Just as an update I have solved this issue by changing the code to use the 
@DynamicRouter annotation instead

@DynamicRouter
 Public String check(Exchange exchange, @Property("id") UUID id, 
@Header(Exchange.SLIP_ENDPOINT) String previous){...}

...
public void configure(){
...
.beanRef("mmc","check")
...
}

[file://W:/data] File                                                  INFO  
ID-DESK-0001-59986-1299158139337-0-2 - fbb470de-cb84-4b4c-b5d2-11610062b194 -  
- 
[el-1) thread #3 - seda://alert] Alert                          INFO  
ID-DESK-0001-59986-1299158139337-0-4 - fbb470de-cb84-4b4c-b5d2-11610062b194 - 
bar - bar
[-1) thread #2 - seda://product] Check                      INFO  
ID-DESK-0001-59986-1299158139337-0-3 - fbb470de-cb84-4b4c-b5d2-11610062b194 - 
bar - bar

I'm not sure why the above annotation works and my previous method doesn't as I 
believe semantically they are the same? Has the .dynamicRouter DSL contain a 
bug? I've tried the previous DSL method with both 2.5.0 and 2.6.0 and get the 
same issue?

Regards,

Caza


> From: [email protected]
> To: [email protected]
> Subject: Exchange headers/properties and dynamic routers
> Date: Wed, 2 Mar 2011 15:22:17 +0000
> 
> 
> Hi All,
> 
>  
> 
> I’m new to Camel so forgive me if I am missing something
> obvious. Basically I have quite a basic route that is using a dynamic router.
> Where I am having problems is setting either properties or headers of the
> Exchange, as when progressing to the next endpoint/route they disappear. From 
> the logging I presume this is because a new Exchange is being created, 
> however if properties are set
> on the original route (File) they seem to be persisted. For example below the 
> “id”
> property persists throughout all the routes, however the property (and the 
> header)
> that I set within the “check” method disappear altogether even within
> the alert endpoint. How should I be doing this, I’ve even tried using
> @OutHeaders but still “bar” does not appear even in “seda:alert” log. Any
> help is appreciated as I guess I'm doing something wrong.
> 
> 
>  
> 
> Caza
> 
>  
> 
> public class Manager {
> 
> ….
> 
> Public String check(Exchange
> exchange, @Property("id") UUID id, @Header(Exchange.SLIP_ENDPOINT) String
> previous)
> 
> …
> 
> UUID result = lookup(id);
> 
>             if(result
> == null){
> 
>                         exchange.getIn().setHeader("foo",
> "bar");
> 
>                         exchange.setProperty("foo",
> "bar");
> 
>                         return
> “seda:alert”;        
> 
> }
> 
> …
> 
> return null;
> 
> …
> 
> }
> 
>  
> 
> public class Router extends RouteBuilder{
> 
> private static final UUID id = 
> UUID.fromString("fbb470de-cb84-4b4c-b5d2-11610062b194");
> 
>  
> 
> public void configure() {
> 
>  
> 
> from("file:W:/data?noop=true").routeId("File")
> 
>                 .setProperty("id",constant(id))
> 
>                 .log("Starting
> to process file: ${header.CamelFileName}") 
> 
>                 .unmarshal().csv().to("seda:product")
> 
>                 .log("${exchangeId} - ${property.supplierId} - 
> ${property.foo} - ${header.foo}");
> 
>  
> 
>         from("seda:product").routeId("Check")
> 
>                 .dynamicRouter(bean("mmc",
> "check"))
> 
>                 .log("${exchangeId} - ${property.supplierId} - 
> ${property.foo} - ${header.foo}");
> 
>  
> 
>         from("seda:alert").routeId("Alert")
> 
>     .log("${exchangeId} - ${property.supplierId} - ${property.foo} - 
> ${header.foo}");    
> 
>         }
> 
> }
> 
>  
> 
> Output:[file://W:/data] File                                     INFO  
> ID-DESK-0001-64505-1299079027828-0-2 - fbb470de-cb84-4b4c-b5d2-11610062b194 - 
>  - 
> [ Camel Thread 3 - seda://alert] Alert           INFO  
> ID-DESK-0001-64505-1299079027828-0-4 - fbb470de-cb84-4b4c-b5d2-11610062b194 - 
>  - 
> [amel Thread 2 - seda://product] Check        INFO  
> ID-DESK-0001-64505-1299079027828-0-3 - fbb470de-cb84-4b4c-b5d2-11610062b194 - 
>  -                                    
                                          

Reply via email to