Internal Order Processor
A worker thread pool processes all events of an order in a sequence as follows:
-
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.
-
Summary of the process: When a message is picked by EMS listeners, it is submitted to the BatchProcessor.
-
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.
-
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 newInternalOrderProcessor
is assigned to the order. This is done on a round-robin basis.
-
-
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 theorder_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. -
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 theapplication.properties
file.
This approach allows for customization flexibility, enabling users to tailor the internal processor size according to their specific needs and configurations.