This worked for me - from("file://d://log//camel").convertBodyTo(String.class) .multicast().to("seda:a", "seda:b"); from("seda:a") .process(new MutlicastRecoveryProcessor("output1")) .choice() .when(header("foo").isEqualTo("one")) .to("log:org.apache.camel.DeadLetterChannel?level=error") .otherwise().to("file://c://log//camel//output1"); from("seda:b") .process(new MutlicastRecoveryProcessor("output2")) .choice() .when(header("foo").isEqualTo("one")) .to("log:org.apache.camel.DeadLetterChannel?level=error") .otherwise().to("file://d://log//camel//output2");
Regards, ~Narita ________________________________________ From: Narita Bagchi Sent: Thursday, November 24, 2011 3:31 PM To: users@camel.apache.org Subject: Selective Multicast I am completely clueless of what I am doing wrong. Below are the 2 code snippets that works. But if I need to place the processor of snippet-2 in snippet-1 it doesn't work. Please help me knowing the reason. I need to solve this urgently now. :-( Working snippet -1 from("file:inbox") .multicast() .to("seda:a") .choice() .when(header("foo").isEqualTo("one")) .to("log:org.apache.camel.DeadLetterChannel?level=error") .otherwise() .to("file://d://log//camel//output1<file:///d://log//camel//output1>") .to("seda:b") .choice() .when(header("foo").isEqualTo("one")) .to("log:org.apache.camel.DeadLetterChannel?level=error") .otherwise() .to("file://d://log//camel//output2<file:///d://log//camel//output2>"); Working snippet -2 from("file:inbox") .multicast() .process(new MutlicastRecoveryProcessor (“output1”)) .to("file://d://log//camel//output1<file:///d://log//camel//output1>") . process(new MutlicastRecoveryProcessor (“output2”)) .to("file://d://log//camel//output2<file:///d://log//camel//output2>"); class MutlicastRecoveryProcessor implements Processor { private String endpointSeqID; public MutlicastRecoveryProcessor(String endpointSeqID) { this.endpointSeqID = endpointSeqID; } @Override public void process(Exchange exchange) throws Exception { if (“output1”.equals(this.endpointSeqID)) { exchange.getIn().setHeader(“foo”,”one”); } } } Non Working snippet -1 from("file:inbox") .multicast() .process(new MutlicastRecoveryProcessor (“output1”)) .to("seda:a") .choice() .when(header("foo").isEqualTo("one")) .to("log:org.apache.camel.DeadLetterChannel?level=error") .otherwise() .to("file://d://log//camel//output1<file:///d://log//camel//output1>") .process(new MutlicastRecoveryProcessor (“output2”)) .to("seda:b") .choice() .when(header("foo").isEqualTo("one")) .to("log:org.apache.camel.DeadLetterChannel?level=error") .otherwise() .to("file://d://log//camel//output2<file:///d://log//camel//output2>"); class MutlicastRecoveryProcessor implements Processor { private String endpointSeqID; public MutlicastRecoveryProcessor(String endpointSeqID) { this.endpointSeqID = endpointSeqID; } @Override public void process(Exchange exchange) throws Exception { if (“output1”.equals(this.endpointSeqID)) { exchange.getIn().setHeader(“foo”,”one”); } } } Thanks. Regards, Narita ________________________________ ***The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review,retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.*** ***The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review,retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.***