camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narita Bagchi <Narita.Bag...@headstrong.com>
Subject Selective Multicast
Date Thu, 24 Nov 2011 10:01:29 GMT
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.***

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message