Hi,
I'm am using a producer template to send to a seda endpoint and it's not
blocking when full. Is there something wrong with my configuration? Using
v2.12.1.
<bean id="fileProcessor" class="FileProcessor">
<property name="workQueueEndpoint" ref="workQueue"></property>
<property name="producerTemplate" ref="producerTemplate"></property>
</bean>
<bean id="dataProcessor" class="DataProcessor"></bean>
<camel:camelContext id="test">
<camel:template id="producerTemplate" />
<camel:endpoint id="workQueue"
uri="seda:workQueue?size=2橪;blockWhenFull=true橪;concurrentConsumers=2橪;timeout=0"
/>
<camel:route>
<camel:from uri="file://c:/dvw/stream?delay=6666"></camel:from>
<camel:process ref="fileProcessor"></camel:process>
</camel:route>
<camel:route>
<camel:from ref="workQueue"></camel:from>
<camel:process ref="dataProcessor"></camel:process>
</camel:route>
</camel:camelContext>
public class FileProcessor implements Processor {
private static final Logger logger = Logger.getLogger(FileProcessor.class);
private Endpoint workQueueEndpoint;
private ProducerTemplate producerTemplate;
@Override
public void process(Exchange exchange) throws Exception {
FileReader fileReader = new
FileReader(exchange.getIn().getBody(File.class));
BufferedReader bufferedReader = new BufferedReader(fileReader);
Queue<Future;Object>> futures = new LinkedList<Future;Object>>();
for (String line = bufferedReader.readLine(); line != null; line =
bufferedReader.readLine()) {
logger.info("Sending " + line);
futures.add(this.getProducerTemplate().asyncRequestBody(this.getWorkQueueEndpoint(),
line));
logger.info("Sent " + line);
while (futures.size() > 0) {
Object o = futures.poll().get();
logger.info("Result for " + o);
bufferedReader.close();
public Endpoint getWorkQueueEndpoint() {
return workQueueEndpoint;
public void setWorkQueueEndpoint(Endpoint workQueueEndpoint) {
this.workQueueEndpoint = workQueueEndpoint;
public ProducerTemplate getProducerTemplate() {
return producerTemplate;
public void setProducerTemplate(ProducerTemplate producerTemplate) {
this.producerTemplate = producerTemplate;
public class DataProcessor implements Processor {
private static final Logger logger = Logger.getLogger(DataProcessor.class);
@Override
public void process(Exchange exchange) throws Exception {
Integer time = exchange.getIn().getBody(Integer.class);
logger.info("Processing data " + time);
Thread.sleep(time.longValue());
logger.info("Completed processing data " + time);
2014-06-23 13:17:38,676|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 2000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 2000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 3000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 3000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 2500
2014-06-23 13:17:38,680|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 2500
2014-06-23 13:17:38,680|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 1000
2014-06-23 13:17:38,680|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 1000
2014-06-23 13:17:38,681|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 4000
2014-06-23 13:17:38,681|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 4000
2014-06-23 13:17:38,681|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 3500
2014-06-23 13:17:38,682|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 3500
2014-06-23 13:17:38,682|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 1500
2014-06-23 13:17:38,682|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 1500
2014-06-23 13:17:38,691|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 4000
2014-06-23 13:17:38,691|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Processing data 2500
2014-06-23 13:17:41,192|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Completed processing data 2500
2014-06-23 13:17:41,193|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Processing data 3500
2014-06-23 13:17:42,692|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 4000
2014-06-23 13:17:42,693|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 1500
2014-06-23 13:17:44,193|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 1500
2014-06-23 13:17:44,194|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 2000
2014-06-23 13:17:44,693|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Completed processing data 3500
2014-06-23 13:17:44,694|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Processing data 3000
2014-06-23 13:17:46,195|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 2000
2014-06-23 13:17:46,196|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 2000
2014-06-23 13:17:46,196|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 1000
2014-06-23 13:17:47,197|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 1000
2014-06-23 13:17:47,695|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Completed processing data 3000
2014-06-23 13:17:47,695|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 3000
2014-06-23 13:17:47,696|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 2500
2014-06-23 13:17:47,696|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 1000
2014-06-23 13:17:47,696|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 4000
2014-06-23 13:17:47,697|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 3500
2014-06-23 13:17:47,697|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 1500
I'm am using a producer template to send to a seda endpoint and it's not
blocking when full. Is there something wrong with my configuration? Using
v2.12.1.
<bean id="fileProcessor" class="FileProcessor">
<property name="workQueueEndpoint" ref="workQueue"></property>
<property name="producerTemplate" ref="producerTemplate"></property>
</bean>
<bean id="dataProcessor" class="DataProcessor"></bean>
<camel:camelContext id="test">
<camel:template id="producerTemplate" />
<camel:endpoint id="workQueue"
uri="seda:workQueue?size=2橪;blockWhenFull=true橪;concurrentConsumers=2橪;timeout=0"
/>
<camel:route>
<camel:from uri="file://c:/dvw/stream?delay=6666"></camel:from>
<camel:process ref="fileProcessor"></camel:process>
</camel:route>
<camel:route>
<camel:from ref="workQueue"></camel:from>
<camel:process ref="dataProcessor"></camel:process>
</camel:route>
</camel:camelContext>
public class FileProcessor implements Processor {
private static final Logger logger = Logger.getLogger(FileProcessor.class);
private Endpoint workQueueEndpoint;
private ProducerTemplate producerTemplate;
@Override
public void process(Exchange exchange) throws Exception {
FileReader fileReader = new
FileReader(exchange.getIn().getBody(File.class));
BufferedReader bufferedReader = new BufferedReader(fileReader);
Queue<Future;Object>> futures = new LinkedList<Future;Object>>();
for (String line = bufferedReader.readLine(); line != null; line =
bufferedReader.readLine()) {
logger.info("Sending " + line);
futures.add(this.getProducerTemplate().asyncRequestBody(this.getWorkQueueEndpoint(),
line));
logger.info("Sent " + line);
while (futures.size() > 0) {
Object o = futures.poll().get();
logger.info("Result for " + o);
bufferedReader.close();
public Endpoint getWorkQueueEndpoint() {
return workQueueEndpoint;
public void setWorkQueueEndpoint(Endpoint workQueueEndpoint) {
this.workQueueEndpoint = workQueueEndpoint;
public ProducerTemplate getProducerTemplate() {
return producerTemplate;
public void setProducerTemplate(ProducerTemplate producerTemplate) {
this.producerTemplate = producerTemplate;
public class DataProcessor implements Processor {
private static final Logger logger = Logger.getLogger(DataProcessor.class);
@Override
public void process(Exchange exchange) throws Exception {
Integer time = exchange.getIn().getBody(Integer.class);
logger.info("Processing data " + time);
Thread.sleep(time.longValue());
logger.info("Completed processing data " + time);
2014-06-23 13:17:38,676|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 2000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 2000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 3000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 3000
2014-06-23 13:17:38,679|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 2500
2014-06-23 13:17:38,680|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 2500
2014-06-23 13:17:38,680|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 1000
2014-06-23 13:17:38,680|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 1000
2014-06-23 13:17:38,681|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 4000
2014-06-23 13:17:38,681|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 4000
2014-06-23 13:17:38,681|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 3500
2014-06-23 13:17:38,682|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 3500
2014-06-23 13:17:38,682|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sending 1500
2014-06-23 13:17:38,682|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Sent 1500
2014-06-23 13:17:38,691|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 4000
2014-06-23 13:17:38,691|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Processing data 2500
2014-06-23 13:17:41,192|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Completed processing data 2500
2014-06-23 13:17:41,193|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Processing data 3500
2014-06-23 13:17:42,692|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 4000
2014-06-23 13:17:42,693|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 1500
2014-06-23 13:17:44,193|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 1500
2014-06-23 13:17:44,194|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 2000
2014-06-23 13:17:44,693|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Completed processing data 3500
2014-06-23 13:17:44,694|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Processing data 3000
2014-06-23 13:17:46,195|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 2000
2014-06-23 13:17:46,196|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 2000
2014-06-23 13:17:46,196|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Processing data 1000
2014-06-23 13:17:47,197|Camel (test) thread #1 - seda://workQueue INFO
DataProcessor | process | Completed processing data 1000
2014-06-23 13:17:47,695|Camel (test) thread #2 - seda://workQueue INFO
DataProcessor | process | Completed processing data 3000
2014-06-23 13:17:47,695|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 3000
2014-06-23 13:17:47,696|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 2500
2014-06-23 13:17:47,696|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 1000
2014-06-23 13:17:47,696|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 4000
2014-06-23 13:17:47,697|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 3500
2014-06-23 13:17:47,697|Camel (test) thread #0 - file://c:/dvw/stream INFO
FileProcessor | process | Result for 1500