44.5. 选择 BlockingQueue 实现
默认情况下,SEDA 组件总是 intantiates 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>
或者,您可以引用 BlockingQueueonnectionFactoryy 实施,3 实现是 LinkedBlockingQueueonnectionFactoryy、ArrayBlockingQueuey 和 PriorityBlockingQueueonnectionFactoryy:
<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>