private int size = 100;
@Test
public void testJmsRequestReplyExclusiveFixedReplyTo() throws Exception {
NotifyBuilder builder = new NotifyBuilder(context).from("direct:start").whenDone(size).create();
StopWatch watch = new StopWatch();
ExecutorService executor = Executors.newFixedThreadPool(10);
for (int i = 0; i < size; i++) {
final Integer num = i;
executor.submit(new Runnable() {
@Override
public void run() {
String reply = template.requestBody("direct:start", "" + num, String.class);
log.info("Sent {} expecting reply 'Hello {}' got --> {}", new Object[]{num, num, reply});
assertNotNull(reply);
assertEquals("Hello " + num, reply);
}
});
}
log.info("Waiting to process {} messages...", size);
assertTrue(builder.matches(60, TimeUnit.SECONDS));
long delta = watch.stop();
log.info("Took {} millis", delta);
// just sleep a bit before shutting down