Internal Order Processor

A worker thread pool processes all events of an order in a sequence as follows:

  1. Picks tasks from a common queue: In a basic thread pool, threads pick tasks from a common queue, where any thread can process any task. Conversely, in the Orchestrator's worker thread pool, threads are created at startup, each with its own dedicated queue. Each worker thread continuously monitors its queue for tasks to process.

  2. Summary of the process: When a message is picked by EMS listeners, it is submitted to the BatchProcessor.

  3. Determines the OrderID: The system determines the order ID from the message. When the Orchestrator sends a request to the southbound system, it includes Originator, OrderId, and TenantID in the JMS header, expecting the southbound system to include this header in the replies. If the OrderId is not present in the JMS header, the system determines it from the message content.

  4. Finds the worker thread (InternalOrderProcessor) to process the order event:

    • If an InternalOrderProcessor is already assigned, the order event is added to its queue.

    • If an InternalOrderProcessor is not assigned, a new InternalOrderProcessor is assigned to the order. This is done on a round-robin basis.

  5. Saves the message or event in the order_event table: After the message is added to the worker thread's queue, it is saved in the order_event table to track incoming messages or events. This ensures that if an Orchestrator instance becomes inactive, these messages can be reassigned to another active instance by the Broker Service.

  6. Deletes the message or event from the order_event table after successful processing.

InternalOrderProcessorSize Calculation

  • In development mode: The orchestrator sets the internalProcessorSize to 1 by default.

  • In non-development mode: The internalProcessorSize is determined as follows:

    internalProcessorSize = 2 × Runtime.getRuntime().getAvailableProcessors()

    This sets the internal processor size to twice the number of available processors.

Overriding InternalOrderProcessorSize

The InternalOrderProcessorSize value can be overridden by setting the internalProcessorSize property through any of the following methods:

  • Environment Variable: Override by setting the internalProcessorSize as an environment variable.

  • Configurator: Use the configurator to define the internalProcessorSize property.

  • application.properties file: Specify the internalProcessorSize in the application.properties file.

This approach allows for customization flexibility, enabling users to tailor the internal processor size according to their specific needs and configurations.