Thread pool for maximum concurrency

To achieve maximum concurrency, SOAP Gateway uses different threads to process requests and to dispatch their responses. The callout threads pull callout messages, whereas the invocation of the external web service and the dispatching of the response is handled by the worker threads in the thread pool.

Callout messages from a tpipe are retrieved by a callout thread and sent to the worker threads for processing. After a message is retrieved, the callout thread validates the message, sends the validated callout message to a free worker thread for processing, and then continues to retrieve the next message.

For a one-way, asynchronous callout message that does not expect a response from the web service, the worker thread completes processing the request (because there is no response) and returns to the free thread pool for future callout requests.

For a request-response callout message:
  • If the callout message is asynchronous, SOAP Gateway sends a response message back to IMS as a new send-only transaction.
  • If the callout request is synchronous, SOAP Gateway sends the response message back to IMS as a new send-only transaction to the requesting IMS application that remains in the dependent region. SOAP Gateway handles the correlation to ensure that the response goes back to the IMS application that initiated the callout request.

In either case (one-way or request-response), the response to the callout request is sent on a different IMS Connect shareable persistent socket connection.

Thread types, in-flight messages, and the work queue

  • The callout threads pull callout messages, validate them, and assign callout messages to a work queue. The callout threads are also referred to as the main threads.
  • The worker threads sleep when there are no callout messages in the work queue to process. When a callout message appears on the queue, a free worker thread is assigned to process it. The worker threads issue the calls to the external web services and return the responses. The number of worker threads is specified in the numberOfWorkerThreadsInPool setting.
  • Messages that are being processed by worker threads are called in-flight messages. The processing of a message by a worker thread is also known as executing a job.
  • The daemon thread maintains the number of worker threads at the configured level. The daemon thread wakes up at an interval that is specified in the checkWorkerHealthInterval callout property to ensure that the required number of worker threads are up. If not, the daemon thread starts additional worker threads to maintain the level that is specified in the numberOfWorkerThreadsInPool callout property. A daemon thread is started when the SOAP Gateway server starts up, to monitor the thread pool.

The numberOfWorkerThreadsInPool property specifies the system resources that are used by SOAP Gateway and must be configured with care. You can configure up to 32 worker threads. The SOAP Gateway management utility can be used to administer the callout threads (for stopping and starting) and to configure this numberOfWorkerThreadsInPool setting.

A worker thread is considered non-existent if the thread exits due to an error.

The thread pool accesses the work queue where callout messages (jobs) are placed for processing. The length of this worker queue, or the number of maximum in-flight messages that are allowed at a given time, is specified in the queueThrottleLength setting.

Callout message processing flow

The following diagram describes the basic flow of a successful callout message processing scenario.
Figure 1. Callout message processing
This diagram shows the basic flow of a successful callout message processing.
  1. The callout thread pulls the callout messages that are placed on the hold queue.
  2. A callout message is retrieved.
  3. The callout thread sends an ACK (or NAK if SOAP Gateway cannot process this message).
  4. The message is placed into the work queue.
  5. A free worker thread is assigned to process the message. The message now becomes an in-flight message. Processing of an in-flight message is referred to as executing a job.
  6. The worker thread sends the callout request to the web service.
  7. The web service returns a response.
  8. The worker thread forwards the response to the initiating client.