java - Camel Splitter producing Incorrect Number of Done Exchanges Seen by NotifyBuilder? -
im using camel 2.10.3.
let's assume have route looks following:
from("direct:split") .routeid("split-ti-analytics-events") .split().method(jsonarraysplitter.class,"split") .parallelprocessing() .log("received: ${body}") .to("stub:direct:somewhere"); and test class following notifybuilder assert splitter doing ought to.
@test(description = "asserts when receive json event split " + "events if payload json array.") public void testreceivetianalyticsarrayofjsonevents() { notifybuilder notifier = new notifybuilder(context) .weresentto("stub:direct:somewhere") .whenexactlydone(7) .create(); producertemplate.sendbody("direct:split", sampleeventsinarrayjsonstring); asserttrue(notifier.matches(5, timeunit.seconds)); } and assume sampleeventsinarrayjsonstring json array looks like:
[{},{},{},{},{},{},{}] where there 7 object elements in json array.
the test fail pretty immediately. however, output of test shows 7 log messages of "received: {}".
now, here's fun part... in notifybuilder if set .whenexactlydone(8), test passes. on earth 8th message coming from? i'd love test valid , call day since know it's getting @ least messages split off json array (ignoring fact i'm not verifying contents in notifybuilder), i'm concerned having 8th exchange sent through route doesn't belong. reason notifybuilder sees 8 exchanges done through route instead of 7?
yes little bug in camel. have logged ticket, , working fix in tests https://issues.apache.org/jira/browse/camel-6255
Comments
Post a Comment