Genpact Cora Knowledge Center

Support

BRS Closed Instances Separator Thread

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 archive tables.

Starting with Cora SeQuence V9.0, the system archives 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.