0
votes

I need to execute a lot of http requests on a specific domain with different query paramerters and I am planning to use outbound-gateway of spring integration with configuration similar to below snippet:

<int-http:outbound-gateway id="httpOutboundGateway" request-channel="requestChannel"
        url="http://www.google.com" http-method="GET" reply-channel="responseChannel"
        expected-response-type="java.lang.String" charset="UTF-8" reply-timeout="5000"
        message-converters="" >
</int-http:outbound-gateway>

I want to execute the requests in request-channel parallelly using some thread pool. I have the following questions in this context:

  1. Will configuring the request-channel as ExecutorChannel automatically executes requests in parallel.
  2. If the answer to question 1 is yes, is it http:outbound-gateway thread safe.
  3. If the answer to question 1 is no, how to configure to execute http requests in parallel
1

1 Answers

0
votes

Actually it depends on the upstream flow. If you send to the requestChannel from the code within a loop at the same Thread, all your requests will be processed serially, one by one.

If all incomming requests come from an end-users from the Web, each request will be done within that thread.

There is no need to go ahead with ExecutorChannel and ThreadPool for it, if your upstream flow is multy-threaded.

All Spring Integration Component are thread-safe. We fight for that stuff all the day. Since Spring Integration is for Messaging, where we don't have context, all those components are stateless.

HTH