更新时间:2023-11-25 13:23:28
要达到这样的要求,您可以使用ExecutorChannel
而不是默认的DirectChannel
.
To achiever such a requirements you can use an ExecutorChannel
instead of default DirectChannel
.
这样,所有的SQS消息都将被分发到ExecutorChannel
提供的线程中,并因此并行执行.
This way all the SQS messages are going to be distributed to the the thread supplied by the ExecutorChannel
and, therefore, performed in parallel.
More info about an ExecutorChannel
is in the Reference Manual.
更新
所以,我的建议应该反映在您当前的配置中,例如:
So, what I suggest should be reflected in your current config like:
<int:channel id="channel_1">
<int:dispatcher task-executor="someExecutor"/>
</int:channel>
更新
如果您仍然坚持拥有多个SQS适配器,则简化版本如下所示:
If you still insist to have several SQS Adapters, then simplified version is like this:
<int-aws:sqs-message-driven-channel-adapter
sqs="sqsAsyncClient"
channel="sqs-to-metricator"
queues="https://sqs.us-east-1.amazonaws.com/123/SomeSQSQueueName"
max-number-of-messages="10"
/>
<int-aws:sqs-message-driven-channel-adapter
sqs="sqsAsyncClient"
channel="sqs-to-metricator"
queues="https://sqs.us-east-1.amazonaws.com/123/SomeSQSQueueName"
max-number-of-messages="10"
/>
<int-aws:sqs-message-driven-channel-adapter
sqs="sqsAsyncClient"
channel="sqs-to-metricator"
queues="https://sqs.us-east-1.amazonaws.com/123/SomeSQSQueueName"
max-number-of-messages="10"
/>
<int:channel id="sqs-to-metricator" />
<int:outbound-channel-adapter ref="restService"
method="publish" channel="sqs-to-metricator" />
为了避免重复,您可以考虑切换到Java DSL并开始使用其ItengrationFlowContext
进行动态IntegrationFlow
注册:
Also to avoid duplication you can consider to switch to the Java DSL and start to use its ItengrationFlowContext
for dynamic IntegrationFlow
registrations: https://docs.spring.io/spring-integration/docs/5.0.4.RELEASE/reference/html/java-dsl.html#java-dsl-runtime-flows