Broadway enables generating and setting new sequences before loading data into a target database. Various sequence patterns can be implemented via the MaskingSequence Actor and other Broadway features.
This article describes the most useful use cases of sequence implementation by Broadway.
A common scenario of sequence implementation is when the same sequence needs to be used per entity across several flows during the same execution. The following use cases of sequence caching are supported:
To implement the above use cases, set a unique maskingId and populate it on the MaskingSequence Actor everywhere the same sequence is used. Keep the useEnvironment as true and the useExecutionID as true in each Actor's settings to generate a new masked value in each execution in the same environment or set it to false to use the same masked value across different executions and environments.
The sequence next value implementation method depends on the sequence definition set by the sequenceInterface input argument. The following use cases are supported:
Sequence initiation can be performed using the initialValue and the increment settings of the Actor and is relevant for in-memory or Redis interface only. In a DB sequence these attributes are managed by the DB. Note that the initial value is cached upon the Actor's first execution. The following use cases are supported:
In Broadway, sequences can be mapped in a number of ways. The following use cases are supported:
Map the old value to the new value: send the old ID to the input value parameter of the sequence actor.
When there is no old value to be mapped to the new value and the target table requires a sequence, leave the input value empty and set the onEmpty parameter of the sequence actor to me MASK_NO_CACHE. The Actor generates a new sequence and returns it in its output. See an example:
Set the sequence as part of the attributes list. An example of the attributes list can be a string which concatenates several pairs of keys and values including the sequence as one of them. To do so, generate the sequence and then create the concatenated attributes list using the JavaScript actor or the actors belong to the strings category.
Set the sequence value based on a condition. For example generate the sequence value only for some entries based on a given condition. To do so, define a Stage Condition in the Broadway flow. The example below replaces the customer ID with a new sequence if the customer ID equals to 1. Otherwise, it maps the original customer ID:
When parent-child relationships exist across Logical Units, the same sequence can exist in both the parent and children. The updated flow can be executed on the parent LU to add a child sequence. For example, if the Customer LU is a parent while the Order LU is a child. After the population of both the Customer and Order LUs is completed, update the Customer LU with the sequence from the Order LU.
Store the relationship between the old and the new sequence. To do so, create a flow that stores these values in the Cassandra TDM_SEQ_MAPPING table under the k2masking keyspace, for example for reporting purposes.
Clone the entities when required. Different sequence values are generated for each cloned entity. This functionality is supported as part of the TDM7 implementation.
Create your own function or Broadway flow to generate a new ID using the MaskingLuFunction or MaskingInnerFlow actors. Set the category to enable_sequences to use the actor for sequence (ID) replacement.
Click for more information about the custom masking actors.
Broadway enables generating and setting new sequences before loading data into a target database. Various sequence patterns can be implemented via the MaskingSequence Actor and other Broadway features.
This article describes the most useful use cases of sequence implementation by Broadway.
A common scenario of sequence implementation is when the same sequence needs to be used per entity across several flows during the same execution. The following use cases of sequence caching are supported:
To implement the above use cases, set a unique maskingId and populate it on the MaskingSequence Actor everywhere the same sequence is used. Keep the useEnvironment as true and the useExecutionID as true in each Actor's settings to generate a new masked value in each execution in the same environment or set it to false to use the same masked value across different executions and environments.
The sequence next value implementation method depends on the sequence definition set by the sequenceInterface input argument. The following use cases are supported:
Sequence initiation can be performed using the initialValue and the increment settings of the Actor and is relevant for in-memory or Redis interface only. In a DB sequence these attributes are managed by the DB. Note that the initial value is cached upon the Actor's first execution. The following use cases are supported:
In Broadway, sequences can be mapped in a number of ways. The following use cases are supported:
Map the old value to the new value: send the old ID to the input value parameter of the sequence actor.
When there is no old value to be mapped to the new value and the target table requires a sequence, leave the input value empty and set the onEmpty parameter of the sequence actor to me MASK_NO_CACHE. The Actor generates a new sequence and returns it in its output. See an example:
Set the sequence as part of the attributes list. An example of the attributes list can be a string which concatenates several pairs of keys and values including the sequence as one of them. To do so, generate the sequence and then create the concatenated attributes list using the JavaScript actor or the actors belong to the strings category.
Set the sequence value based on a condition. For example generate the sequence value only for some entries based on a given condition. To do so, define a Stage Condition in the Broadway flow. The example below replaces the customer ID with a new sequence if the customer ID equals to 1. Otherwise, it maps the original customer ID:
When parent-child relationships exist across Logical Units, the same sequence can exist in both the parent and children. The updated flow can be executed on the parent LU to add a child sequence. For example, if the Customer LU is a parent while the Order LU is a child. After the population of both the Customer and Order LUs is completed, update the Customer LU with the sequence from the Order LU.
Store the relationship between the old and the new sequence. To do so, create a flow that stores these values in the Cassandra TDM_SEQ_MAPPING table under the k2masking keyspace, for example for reporting purposes.
Clone the entities when required. Different sequence values are generated for each cloned entity. This functionality is supported as part of the TDM7 implementation.
Create your own function or Broadway flow to generate a new ID using the MaskingLuFunction or MaskingInnerFlow actors. Set the category to enable_sequences to use the actor for sequence (ID) replacement.
Click for more information about the custom masking actors.