Process Context

Process context plays a significant role in managing value streams. Learn the details.

The process context is an important part of the Orchestration Engine system as it holds all the external information regarding the processing of a specific value stream instance.

A process context is a JSON object that consists of three primary sections:

  • Context: contains all the event-types received during the value stream run, their associated payloads (if any), and the initial payload when the value stream is started.

  • Metadata: provides additional information about the process context, such as the tenant identifier.

  • Status: represents the current status of the process context.

Here's an example of a process context in JSON format.

 {
        "metadata": {
            "tenant": "01H7YP07GX9TFRK4S0RRGZ11WT",
            "createdAt": "2023-10-16T10:13:42.322Z",
            "updatedAt": "2023-10-16T10:14:09.354Z"
        },
        "context": {
            "executionTemplateID": "01HCD6ZYTDSBZ6KS1GNQYX529N",
            "executionTemplateVersionID": "01HCJ2VRN61N7J5WQSYQ9Z1JEZ",
            "instanceid": "691a4c2c-595b-4b3c-9cf3-0471f6e074c8",
            "metadata": {
                "externalID": "",
                "scenarioid": ""
            },
            "order.found": {
                "orderId": "EON1075"
            },
            "order.spotbuy.pending": {},
            "order.spotbuy.received": {
                "contact": {
                    "companyId": "",
                    "companyName": "",
                    "id": "",
                    "language": "en",
                    "name": "",
                    "value": ""
                },
                "contacts": [],
                "forms": [
                    {
                        "metadata": {
                            "formId": "01HAPCT5KS0T7METVDM4GBM0MC",
                            "formName": "PO Form"
                        },
                        "payload": {
                            "businessNeed": "Spot Buy",
                            "expectedDeliveryDate": "2023-10-18T09:00:00.000Z",
                            "item": "30610403",
                            "itemCost": 112.79,
                            "orderDate": "2023-10-16T10:13:42.183Z",
                            "purchaseOrderNumber": "EON1075-30610403",
                            "purchaseSum": 360.928,
                            "quantity": 4,
                            "requesterName": "Emporix",
                            "requestorEmail": "[email protected]",
                            "select": "pending"
                        }
                    }
                ],
                "magicLinkId": "01HCVZM8QK3RNNJ14FG1WBBT92",
                "submission": 1
            },
            "processid": "01HCJ2VRN61N7J5WQSYQ9Z1JEZ-01H7YP07GX9TFBK2S0RRGZ11WY-01HCVZM98AP21QG53MEBRE9XVM"
        },
        "status": "finished"
    }

Context

The context section holds all the event types received during the value stream run and the payload associated with each of them, if any. It also contains the initial payload when the value stream is started. The following keys are present in the context section:

  • executionTemplateID: The unique identifier for the value stream.

  • executionTemplateVersionID: The unique identifier for the specific version of the value stream.

  • instanceid: The unique identifier for the instance of the value stream run.

  • processid: A unique identifier for the workflow. It combines the tenant ID, value stream name, value stream version ID, and an additional unique identifier.

Event types are keys within the context object that represent specific events that occurred during the value stream run. Each event type may have an associated payload.

In the example provided, product_assigned_discount_category is an event type with the payload:

This means that when the value stream run received a product_assigned_discount_category event, the event carried the payload with the discount_category set to vip.

Metadata

The metadata section provides additional information about the process context. The example contains the tenantkey, which represents the unique identifier for the tenant associated with the process context. You can also see the createdAt and updatedAt fields with timestamps - you can check when the process context for a given value stream instance was created and updated.

Status

The status section indicates the current status of the process context. The statuses that are valid for the process context, are either Started or Finished. In the provided example, the status is finished, meaning the value stream run has been completed. If the value stream run is completed and the process context status if finished, we can no longer write to this process context.

The process context is a critical component in the system that enables tracking and managing the processing of the value stream versions. Understanding its structure and the information it holds, developers and users can effectively interact with it and monitor it as well.

Last updated

Was this helpful?