57.5. 选择 BlockingQueue 实现
默认情况下,SEDA 组件始终会忽略 LinkedBlockingQueue,但您可以使用不同的实现,您可以引用您自己的 BlockingQueue 实现,在这种情况下没有使用 size 选项
<bean id="arrayQueue" class="java.util.ArrayBlockingQueue"> <constructor-arg index="0" value="10" ><!-- size --> <constructor-arg index="1" value="true" ><!-- fairness --> </bean> <!-- ... and later --> <from>seda:array?queue=#arrayQueue</from>
或者,您可以引用 BlockingQueueFactory 实现,3 个实现提供了 LinkedBlockingQueueFactory、ArrayBlockingQueueFactory 和 PriorityBlockingQueueFactory:
<bean id="priorityQueueFactory" class="org.apache.camel.component.seda.PriorityBlockingQueueFactory"> <property name="comparator"> <bean class="org.apache.camel.demo.MyExchangeComparator" /> </property> </bean> <!-- ... and later --> <from>seda:priority?queueFactory=#priorityQueueFactory&size=100</from>