我遇到了从CXF端点并行消费的问题。例如,如果我将50个或更多并发请求发送到在Camel路由中发布为CXF端点的Web服务中,则只有25个线程从中消耗并开始路由处理。无论Web服务器上的SYNC / ASYNC请求处理如何,都会发生这种情况(默认情况下使用Jetty)。我试图增加Jetty池的大小-也没有任何效果。因此问题是:在哪里定义了从CXF端点开始的并行消费限制。
我们在JBossFuse 6.2.1下拥有Apache Camel 2.15.1,Apache CXF 3.0.4
这是Jetty和CXF端点配置:
<!-- Jetty -->
<bean id="server" class="org.eclipse.jetty.server.Server"/>
<httpj:engine-factory bus="cxf">
<httpj:identifiedThreadingParameters id="sampleThreading1">
<httpj:threadingParameters minThreads="100" maxThreads="200"/>
</httpj:identifiedThreadingParameters>
<httpj:engine port="9001">
<httpj:threadingParametersRef id="sampleThreading1"/>
<httpj:connector>
<bean class="org.eclipse.jetty.server.bio.SocketConnector">
<property name = "port" value="9001" />
</bean>
</httpj:connector>
<httpj:handlers>
<bean class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</httpj:handlers>
<httpj:sessionSupport>true</httpj:sessionSupport>
</httpj:engine>
</httpj:engine-factory>
<!-- CXF -->
<cxf:cxfEndpoint
id="abcOutboundService"
address="http://localhost:9001/cxf/ABCOutbound"
xmlns:s="http://www.smpbank.ru/ABC"
serviceName="s:ABCOutboundRq"
endpointName="s:ASBOABCOutPort"
wsdlURL="model/ASBOABCOut/ABCOutboundRq.wsdl">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
</cxf:properties>
</cxf:cxfEndpoint>
以及路线定义:
<camelContext id="AdpABCOutReq_WS" xmlns="http://camel.apache.org/schema/blueprint">
<route id="adpabcout.ws" startupOrder="10" errorHandlerRef="wsProcessingErrorHandler">
<from uri="cxf:bean:abcOutboundService"/>
<log message="REQUEST CONSUMED BY Thread:[${threadName}] FROM WEB SERVICE: Headers:[${headers}]\nBody:[${body}]"/>
...
</route>
</camelContext>
答案 0 :(得分:0)
您可能正在遇到CXF工作队列限制。您可以尝试通过
设置工作队列 <cxfcore:workqueue name="default"
highWaterMark="${work.queue.high.limit}"
lowWaterMark="${work.queue.low.limit}"
initialSize="${work.queue.initial.size}"
dequeueTimeout="${work.queue.timeout}"
queueSize="${work.queue.size}"/>
默认值为highWaterMark=25
,lowWaterMark=5
,initialSize=0
,queueSize=256
和queueTimeout=2mins