Temporal Queue Dependencies

In many cases, Platform may receive Messages which must be processed in a certain order. This ordering may allow for some parallelization (improving performance), but only when certain dependencies are met. Temporal dependencies allow us to specify rules along the lines of: Given Queue A with next message M yet to be dequeued (or currently processing), the next message N in Queue B should not be dequeued while M.CreationDate is older than N.CreationDate.

In other words, don't process the next message in Queue B while an older message remains unprocessed in Queue A. For example, let's assume you have three queues in your application: one for processing Enterprises, one for processing Orders, and one for processing Shipments. Both Orders and Shipments rely on the Enterprise feed to be up-to-date as they reference those Enterprises. However, we can process the Orders and Shipments in parallel because they have no dependencies between one another. In this case, we could setup two Temporal Queue Dependencies:

images/download/attachments/144836025/temporal_queue_dependencies-version-1-modificationdate-1645136491000-api-v2.png

inbox/Orders depends on inbox/Enterprises, and inbox/Shipments depends on inbox/Enterprises

These dependencies are established by creating MsgQueueDependency models. For example, the dependencies above could be created through SOAP or load-data as follows:

<ModelList xmlns="http://www.onenetwork.com/Platform">
<ValueChainId>9123</ValueChainId>
<CustomModelName>Standard MsgQueueDependency</CustomModelName>
<ActionName>PLT.Create</ActionName>
<MsgQueueDependency>
<ValueChainId>9123</ValueChainId>
<MessageQueueName>inbox/Orders</MessageQueueName>
<DependsOnName>inbox/Enterprises</DependsOnName>
<DependencyType>Temporal</DependencyType>
</MsgQueueDependency>
<MsgQueueDependency>
<ValueChainId>9123</ValueChainId>
<MessageQueueName>inbox/Shipments</MessageQueueName>
<DependsOnName>inbox/Enterprises</DependsOnName>
<DependencyType>Temporal</DependencyType>
</MsgQueueDependency>
</ModelList>

The fields available on MsgQueueDependency are:

Table 16.10. MsgQueueDependency Fields

Field

Description

ValueChainId

Value Chain which owns the MsgQueueDependency. (KEY field)

MessageQueueName

Name of Queue which depends on another Queue (in the previous example, Queue B) (KEY field)

MessageQueueEnterpriseName

If MessageQueueName is enterprise-scoped, identifies that enterprise (optional KEY field)

DependsOnName

Name of Queue upon which to depend (in the previous example, Queue A) (KEY field)

DependsOnEnterpriseName

If DependsOnName is enterprise-scoped, identifies that enterprise (optional KEY field)

DependencyType

"Temporal" is the only type available currently. Temporal dependency means do not dequeue from MessageQueue while DependsOn has an older message pending or currently processing.

Note that there are no limits on depth, so we could have an additional queue inbox/OrderDetails which depends on inbox/Orders, and so on.