0
from("seda:myqueue?size=2&blockWhenFull=true").process(sleep());
private Processor sleep() {
return new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
System.out.println(curTime() + " Going for sleep sleepid=" + body);
Thread.sleep(5000l);
System.out.println(curTime() + " Done sleep sleepid=" + body);
}
};
for (Integer i = 0; i <5; i++) {
Exchange exchange = new DefaultExchange(context);
exchange.setPattern(ExchangePattern.InOnly);
exchange.getIn().setHeader("header", i);
exchange.getIn().setBody(i.toString());
System.out.println("sending msg to seda");
Exchange send = template.send("seda:myqueue",exchange);
System.out.println("done:"+i);
}
「BlockWhenFull
」未確認如果大小被設置爲2,即,我發送3 MSG在循環中與身體爲「1」,「2」和「3」,比即使當我將「BlockWhenFull
」設置爲真時,我也只能獲得「1」和「2」的睡眠信息,而且我猜測第三個信息會悄悄丟棄。Apache的駱駝塞達端點,BlockWhenFull未確認
我在做什麼錯?
版本:2.15.3
喔,我看到生產者,例如
blockWhenFull
|比爲什麼沒有得到如doc中提到的異常「默認情況下,將拋出異常,說明隊列已滿。」http://camel.apache.org/seda.html – Bhuvan