Genpact Cora Knowledge Center

Support

BRS Closed Instances Separator Thread

V9.5

Overview

The Closed Instances Separator thread is part of the Cora SeQuence Background Runtime Service (BRS). This thread runs through all the closed and aborted workflow instances, and moves their data records to closed tables in batches. 

For aborted workflow instances, the system waits for the set retention delay time to be completed, and then moves them to the closed tables.  

Thread parameters

You can configure the thread parameters in the BRS application configuration file:PNMsoft.Sequence.WindowsServices.BRS.exe.config

ParameterDescription
intervalThe idle time of the thread between checking for and moving closed workflow instance content.
Unit: minutes
startAtThe time of day the thread begins to work.
stopAtThe time of day the thread ends its work.


NOTE

  • If you want the thread to work all the time, leave the startAt and stopAt parameters empty.
  • It is recommended that you set the thread to run outside of the system's peak hours.

Closed metadata tables

  • tblInstanceWorkflowsClosed
  • tblInstanceActivitiesClosed
  • tblActionItemsClosed
  • tblAttachmentsClosed
  • tblActionItemsAttachmentsClosed
  • tblActionItemRemindersClosed
  • tblActionItemsOrgsClosed
  • tblInstanceActivitiesRollbackClosed
  • tblInstanceWorkflowsDataPropagationClosed
  • tblInstanceWorkflowsRollbackClosed
  • tblSolutionCasesClosed 
  • tblAllocatedSolutionCasesClosed
  • tblSolutionTasksClosed
  • tblAllocatedSolutionTasksClosed

Batch parameters

You can set up application variables to determine batch size, number of instances in batches, and the delay after which aborted instances are moved to closed tables.

KeyDescriptionVersion
BRS.MoveToClosed.BatchSizeDetermines the number of instances that are moved in every batch.
Default: 100
9.0
BRS.MoveToClosed.NumberOfBatchesInOneCycleMaximum number of batches that run in a single service cycle run.
Default: 10
9.0
BRS.MoveToClosed.AbortedWorkflowInstancesRetentionDelayInDays
Delay in moving aborted instances to closed tables.
Default: 7
9.5

Both BRS.MoveToClosed.BatchSize and BRS.MoveToClosed.NumberOfBatchesInOneCycle parameters determine the number of workflow instances that are moved in every service cycle.
For example: 100 X 10 = 1000 instances in one cycle.

NOTES

  • When the properties are not configured in the application variables, the system uses the default values. 
  • If you get a transaction timeout message while the Closed Instances Separator thread is running, consider decreasing the batch size value.

Set up a custom archiving mechanism

Starting with Cora SeQuence V9.0, you can use a stored procedure extension option to set up an archiving mechanism for any database table. The stored procedure should contain the full extended archiving functionality:

  • INSERT INTO closed table
  • DELETE FROM the original table

Procedure

  1. Edit the extension stored procedure: spBRS_MoveWorkflowInstancesToClosedTablesExtension.

NOTE
The stored procedure runs automatically as part of the BRS Closed Instance Separator Thread.

Example

INSERT INTO UWFxxxClosed
SELECT uwf.*
FROM   UWFxxx uwf WITH(NOLOCK)
INNER JOIN
     #tmpWorkflowInstancesBatch iwc
ON uwf.fldIWfId = iwc.fldId


DELETE       uwf
FROM         UWFxxx uwf WITH(NOLOCK)
INNER JOIN
            #tmpWorkflowInstancesBatch iwc
ON uwf.fldIWfId = iwc.fldId

IMPORTANT
Use INNER JOIN between the table that you want to archive and #tmpWorkflowInstancesBatch to move only a batch of data.
The  #tmpWorkflowInstancesBatch table is created by the spBRS_MoveWorkflowInstancesToClosedTables stored procedure.

V9.0 and earlier

Overview

The Closed Instances Separator thread is part of the Cora SeQuence Background Runtime Service (BRS). This thread runs through all the closed workflow instances and moves their data records to closed tables.

Starting with Cora SeQuence V9.0, the system moves data in batches. 

Thread parameters

You can configure the thread parameters in the BRS application configuration file:PNMsoft.Sequence.WindowsServices.BRS.exe.config

ParameterDescription
intervalThe idle time of the thread between checking for and moving closed workflow instance content.
Unit: minutes
startAtThe time of day the thread begins to work.
stopAtThe time of day the thread ends its work.


NOTE

  • If you want the thread to work all the time, leave the startAt and stopAt parameters empty.
  • It is recommended that you set the thread to run outside of the system's peak hours.

Archived metadata tables

  • tblInstanceWorkflowsClosed
  • tblInstanceActivitiesClosed
  • tblActionItemsClosed
  • tblAttachmentsClosed
  • tblActionItemsAttachmentsClosed
  • tblActionItemRemindersClosed
  • tblActionItemsOrgsClosed
  • tblInstanceActivitiesRollbackClosed
  • tblInstanceWorkflowsDataPropagationClosed
  • tblInstanceWorkflowsRollbackClosed
  • tblSolutionCasesClosed 
  • tblAllocatedSolutionCasesClosed
  • tblSolutionTasksClosed
  • tblAllocatedSolutionTasksClosed

Batch parameters

Starting with V9.0, you can set up application variables to determine batch size and number of instances in batches. 

KeyDescription
BRS.MoveToClosed.BatchSizeDetermines the number of instances that are moved in every batch.

Default: 100

BRS.MoveToClosed.NumberOfBatchesInOneCycleMaximum number of batches that run in a single service cycle run.

Default: 10

Both parameters determine the number of workflow instances that are moved in every service cycle.
For example: 100 X 10 = 1000 instances in one cycle.

NOTES

  • When the properties are not configured in the application variables, the system uses the default values. 
  • If you get a transaction timeout message while the Closed Instances Separator thread is running, consider decreasing the batch size value.

Set up a custom archiving mechanism

Starting with Cora SeQuence V9.0, you can use a stored procedure extension option to set up an archiving mechanism for any database table. The stored procedure should contain the full extended archiving functionality:

  • INSERT INTO archive table
  • DELETE FROM the original table

Procedure

  1. Edit the extension stored procedure: spBRS_MoveWorkflowInstancesToClosedTablesExtension.

NOTE
The stored procedure runs automatically as part of the BRS Closed Instance Separator Thread.

Example

INSERT INTO UWFxxxClosed
SELECT uwf.*
FROM   UWFxxx uwf WITH(NOLOCK)
INNER JOIN
     #tmpWorkflowInstancesBatch iwc
ON uwf.fldIWfId = iwc.fldId


DELETE       uwf
FROM         UWFxxx uwf WITH(NOLOCK)
INNER JOIN
            #tmpWorkflowInstancesBatch iwc
ON uwf.fldIWfId = iwc.fldId

IMPORTANT
Use INNER JOIN between the table that you want to archive and #tmpWorkflowInstancesBatch to move only a batch of data.
The  #tmpWorkflowInstancesBatch table is created by the spBRS_MoveWorkflowInstancesToClosedTables stored procedure.