本文介绍了Apache的骆驼顺器与Apache骆驼SEDA队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用参数concurrentConsumers = 5一SEDA队列。现在,我想它与Apache的骆驼顺器整合,以便能够处理不过它们之前重新排序的消息,当我这样做,只有一个消息在同一时间处理。我想知道是否可以并行运行多个顺器的消息。

I have a SEDA queue that uses the parameter "concurrentConsumers=5". Now, I am trying to integrate it with the Apache Camel Resequencer in order to be able to reorder the messages before processing them, however, when I do this, only one message is processed at a time. I would like to know if it is possible to run several resequencer messages in parallel.

这是我的XML code:

This is my XML code:

        <route>
            <from uri="seda:barSetup?concurrentConsumers=5" />
                <resequence>
                <batch-config batchSize="300" batchTimeout="40000"
                 allowDuplicates="true"/>
                    <simple>in.header.priority</simple>
                    <to uri="exec:cat" />
                    <to uri="bean:batchjobMonitor" />
                    <to uri="log:output" />
                </resequence>
            </route>

我不是很熟悉的队列或骆驼所以,对不起,如果这是一个愚蠢的问题。

I am not very familiar with queues or Camel so, sorry if this is a stupid question.

感谢。

推荐答案

我终于解决了这个没有使用顺器。我用PriorityBlockingQueueFactory,并在比较我使用了类似的再顺向骆驼:

Finally I solved this not using the resequencer. I used the PriorityBlockingQueueFactory and in the comparator I use a similar resequencer to camel:

    <bean id="priorityQueueFactory"
        class="org.apache.camel.component.seda.PriorityBlockingQueueFactory">
        <property name="comparator">
            <bean class="com.sg.sgf.service.queues.MyExchangeComparator" />
        </property>
    </bean>

然后,在路径

        <route>
            <from uri="seda:priority?queueFactory=#priorityQueueFactory&amp;size=100&amp;concurrentConsumers=5&amp;pollTimeout=10000" />
            <!-- <resequence>
                <batch-config batchSize="300" batchTimeout="40000"
                    allowDuplicates="true" />
                <simple>in.header.priority</simple> -->
                <to uri="exec:cat" />       <!-- the actual executable is set in the job that is passed to the queue -->
                <to uri="bean:batchjobMonitor" />
                <to uri="log:output" />
            <!-- </resequence> -->
        </route>

有了这个,我有我想要的东西。

With this, I have what I wanted.

这篇关于Apache的骆驼顺器与Apache骆驼SEDA队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-27 16:34