camel IllegalStateException:队列已满

时间:2015-07-08 16:36:44

标签: queue apache-camel

我有一条大小设置为5000的路线,如下所示:

    <route id="rdfProcessContent">
        <from uri="vm:rdfProcessContent?concurrentConsumers=2&size=5000&blockWhenFull=true"/>
        .........
    </route>    

一个问题 - 5000大小,是太多还是我可以做更高的事情?或者我还能做些什么吗?另外,我使用了try / catch(下面),但这是处理完整队列的好方法吗? 如果重要,可以通过以下方式访问路径:

def endPoint = camelContext.getEndpoint("vm:rdfProcessContent?size=5000");
def producer = endPoint.createProducer();
.... 
try{
    while(gotNextPage)
    {
        ...
        contentList.each{
            ...
            def exchange = endPoint.createExchange(org.apache.camel.ExchangePattern.InOnly);
            exchange.getIn().setBody(it);
            exchange.getIn().setHeader("isBulkLoad", "true" );  
            producer.process(exchange);                     
        }
    }
}catch(){...}

这是我得到的错误(错误的第一位):

java.lang.IllegalStateException: Queue full
at java.util.AbstractQueue.add(AbstractQueue.java:71)
at org.apache.camel.component.seda.SedaProducer.addToQueue(SedaProducer.java:233)
at org.apache.camel.component.seda.SedaProducer.process(SedaProducer.java:170)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:113)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:58)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)

感谢您抽出宝贵时间。

1 个答案:

答案 0 :(得分:0)

在挖掘之后,我发现问题不在于路径“rdfProcessContent”,而在于执行的路线更远 - 我使用JAVA api发布图表。结果比发布sparql查询要慢得多 - 这是一个很大的惊喜。