简体   繁体   English

限制Mule的JDBC入站中的线程数

[英]Limit number of threads in Mule's JDBC inbound

I have a jdbc inbound endpoint that selects tens of thousands of records. 我有一个选择成千上万条记录的jdbc入站端点。 Mule automatically spits them up and process each of them concurrently. Mule自动将它们吐出并同时处理它们。 The problem is, the process involves calling another service that cannot handle so many requests at the same time. 问题是,该过程涉及调用另一个无法同时处理这么多请求的服务。 Is there a way to limit the number of concurrent threads so that not that many requests happen at the same time? 有没有一种方法可以限制并发线程的数量,以便不会同时发生很多请求? I am reading http://www.mulesoft.org/documentation/display/current/Configuring+a+Transport#ConfiguringaTransport-receiver but I cannot grasp how to do it. 我正在阅读http://www.mulesoft.org/documentation/display/current/Configuring+a+Transport#ConfiguringaTransport-receiver,但我不知道该怎么做。 I tried: 我试过了:

<jdbc-ee:inbound-endpoint doc:name="db" connector-ref="testConnector" exchange-pattern="one-way" pollingFrequency="60000" queryTimeout="-1" queryKey="findAllPersonIds">
    <receiver-threading-profile maxThreadsActive="2" />
</jdbc-ee:inbound-endpoint>

But when I try to start it, Mule complains that 'receiver-threading-profile' isn't valid. 但是当我尝试启动它时,Mule抱怨“ receiver-threading-profile”无效。

A JDBC inbound endpoint is a poller endpoint, which is backed by a single thread per Mule instance (or per cluster if you run EE). JDBC入站端点是轮询端点,由每个Mule实例(或如果运行EE的每个群集)的单个线程支持。

The parallelism you're experiencing comes from the flow processing strategy, which by default has a threading profile that will use multiple concurrent threads. 您遇到的并行性来自流处理策略,该策略默认情况下具有一个线程配置文件,该配置文件将使用多个并发线程。

You need to limit this parallelism for the flow that performs the remote HTTP invocation. 您需要为执行远程HTTP调用的流限制这种并行性。 You haven't shown your config so I can't tell if it's the same flow where the inbound JDBC endpoint is. 您尚未显示配置,所以我无法确定入站JDBC端点所在的流是否相同。

With the information you have provided, the best I can do is direct you to the reference documentation: http://www.mulesoft.org/documentation/display/current/Flow+Processing+Strategies 利用您提供的信息,我能做的最好的就是将您导向参考文档: http : //www.mulesoft.org/documentation/display/current/Flow+Processing+Strategies

From this documentation, here is a flow that will use 500 concurrent threads: 从此文档中,这是将使用500个并发线程的流:

<queued-asynchronous-processing-strategy name="allow500Threads"
                                         maxThreads="500"/>

<flow name="manyThreads" processingStrategy="allow500Threads">
  <vm:inbound-endpoint path="manyThreads" exchange-pattern="one-way"/>
  <vm:outbound-endpoint path="output" exchange-pattern="one-way"/>
</flow>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM