0
我完全不知道我做錯了什麼。以下是可用的2個代碼片段。但是,如果我需要將snippet-2的處理器放入代碼片段1中,則不起作用。 請幫我知道原因。我現在需要緊急解決這個問題。Apache Camel Multicast CBR不能與多核處理器一起使用處理器
工作片斷-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>");
工作片斷-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」);
}
}
}
非工作片斷-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」);
}
}
}