// should at least take 3 sec
mock.setMinimumResultWaitTime(3000);
// use our own template that has a higher thread pool than default camel that uses 5
ExecutorService executor = Executors.newFixedThreadPool(10);
ProducerTemplate pt = new DefaultProducerTemplate(context, executor);
// must start the template
pt.start();
List<Future> replies = new ArrayList<Future>(20);
for (int i = 0; i < 20; i++) {
Future<Object> out = pt.asyncRequestBody("seda:bar", "Message " + i);
replies.add(out);
}
assertMockEndpointsSatisfied();
assertEquals(20, replies.size());
for (int i = 0; i < 20; i++) {
String out = (String) replies.get(i).get();
assertTrue(out.startsWith("Bye"));
}
pt.stop();
executor.shutdownNow();
}