All about Context in the Conscia DX Engine

This blog post contains information about Context in the Conscia Digital Experience Engine (DX Engine), which is part of the Conscia’s SaaS Digital Experience Orchestration (DXO) offering. If you have information or questions about Context, please comment on this blog post. This blog post is part of a series All about the Conscia DX Engine.

We can think of Context as a JSON object that the DX Engine passes to each Component in an orchestration flow.

Components are individual steps in an orchestration process; one component might invoke a Webservice API and another Component might transform its JSON response.

Context allows us to pass data to an orchestration flow, for Components in that flow to pass data to each other, and for users to define Experience Rules that use those values, such as to personalize experiences based on a visitor’s audience segment defined in Context.

Each Component can retrieve values from Context and set values in Context. Retrieving a value from Context creates a dependency between the Component that retrieves the value and any components that set that value in Context. In other words, if two Components set a Context value, and another Component reads that value, then the DX Engine will invoke the two Components that set that value before it invokes the Component that reads that value.

The client invoking a Conscia orchestration flow passes Context. You can use the debugger in the DX Engine to pass Context explicitly to an Orchestration Template and Orchestration Components.

You can use the contextField() function to retrieve Context values.

Context values can be nested JSON structures. For example, given Context such as the following;

{
  "user": {
    "email": "{email-address}"
  }
}

You can access the value of email as contextField(‘user’).email.

To allow users to work with Context values in the DX Studio UI of DX Engine, such as to use Context values in Experience Rules, you can use DX Studio to define Context Fields.

Components can define Context values in a process referred to as Context Field Enrichment. To define Context values, in the Component definition, select the Update Context area from the drop-down at the top right. You can add any number of Context Fields, where each specifies the name of the context value and a JavaScript expression to set its value.

Setting a Context value from a Component makes that Context value depend on that Component. Using a Context value from a Component makes that Component depend on that Context value and hence any Components that set its value. The DX Engine will invoke all Components that set a Context value before invoking any Component that uses its value. Context value dependencies appear in the DX Studio Visualizer.

The DX Engine constructs a unique Context for each Subcomponent.

2 thoughts on “All about Context in the Conscia DX Engine

Leave a comment