Java camel activemq组件和CustomProcessor

Java camel activemq组件和CustomProcessor,java,activemq,apache-camel,Java,Activemq,Apache Camel,我有一个队列,我希望从中以并发方式使用消息,然后通过实现org.apache.camel.Processor将这些消息传递给MyProcessor,我希望MyProcessor也以并行方式运行。请注意,MyProcessor使用reantrantlock调用runnable from(activemq:Myqueue?maxConcurrentConsumers=10) .process(new MyProcessor()); class MyProcessor implements o

我有一个队列,我希望从中以并发方式使用消息,然后通过实现org.apache.camel.Processor将这些消息传递给MyProcessor,我希望MyProcessor也以并行方式运行。请注意,MyProcessor使用reantrantlock调用runnable

from(activemq:Myqueue?maxConcurrentConsumers=10)
   .process(new MyProcessor());

class MyProcessor implements org.apache.camel.Processor {

    @Override
    public void process(Exchange exchange) throws Exception {

                      // Do some process

                      sleep(1000)

        }
    }

它会以并行方式运行吗

是的,您可以将Camel JMS/ActiveMQ端点配置为使用并发使用者,然后Camel rotue将并行处理消息

from("activemq:Myqueue?concurrentConsumers=5&maxConcurrentConsumers=10")
    .process(new MyProcessor());
端点有2个选项可设置并发使用者的范围。在上面的代码中,我们的范围是5-10

有关更多详细信息,请访问: