what do you think about this code:
(I need to know how dangerous is this code)
config:
<template id="camelTemplate"/>
<route>
<from uri="activemq:test99"/>
<to
uri="seda:bar?concurrentConsumers=5&waitForTaskToComplete=Never"/>
</route>
<route>
<from
uri="seda:bar?concurrentConsumers=5&waitForTaskToComplete=Never"/>
<to uri="bean:TestG1"/>
</route>
...
<bean id="TestG1" class="CamelBean99.TestG1">
<property name="producerTemplate" ref="camelTemplate"/>
</bean>
my GROOVY bean:
class TestG1 implements Processor {
private static final transient Log LOG = LogFactory.getLog(TestG1.class
);
int counter;
ProducerTemplate producerTemplate;
void process(Exchange exchange) {
synchronized (this.counter) {this.counter++;
LOG.info("DO THAT ${Thread.currentThread().id} ${this}
${counter}");
}
sleep(5000);
String o=exchange.in.getBody(String.class);
if(exchange.in.headers["JMSReplyTo"]!=null){
producerTemplate.sendBody(
'activemq:'+exchange.in.headers["JMSReplyTo"],"${o} ${counter} ${new
Date().calendarDate.toString()}");
}
synchronized (this.counter) {this.counter--;
LOG.info("DO END ${Thread.currentThread().id} ${this} ${counter}")
}
}
}
log output:
[07:13:20] INFO [CamelBean99.TestG1] - DO THAT 26 camelbean99.tes...@189346e
1
[07:13:20] INFO [CamelBean99.TestG1] - DO THAT 23 camelbean99.tes...@189346e
2
[07:13:20] INFO [CamelBean99.TestG1] - DO THAT 24 camelbean99.tes...@189346e
3
[07:13:20] INFO [CamelBean99.TestG1] - DO THAT 25 camelbean99.tes...@189346e
4
[07:13:20] INFO [CamelBean99.TestG1] - DO THAT 27 camelbean99.tes...@189346e
5
[07:13:26] INFO [CamelBean99.TestG1] - DO END 26 camelbean99.tes...@189346e
4
[07:13:26] INFO [CamelBean99.TestG1] - DO END 27 camelbean99.tes...@189346e
3
[07:13:26] INFO [CamelBean99.TestG1] - DO END 24 camelbean99.tes...@189346e
2
[07:13:26] INFO [CamelBean99.TestG1] - DO END 23 camelbean99.tes...@189346e
1
[07:13:26] INFO [CamelBean99.TestG1] - DO END 25 camelbean99.tes...@189346e
0
--
View this message in context:
http://camel.465427.n5.nabble.com/SEDA-with-request-response-tp2844259p2844659.html
Sent from the Camel - Users mailing list archive at Nabble.com.