Removing redundant processes from the NJProcess table
The NJProcess table stores the states of NexJ processes that occur periodically. The current state of a process also displays in the Process page in NexJ Admin Console.
In NexJ Studio, you can create a batch job that will periodically clean up old processes. The batch job must define which processes to delete and must invoke the ETLDelete ETL activity to ensure the NJProcess table and all related tables are also cleaned up. Consider the following when creating the batch job:
Specify that the batch job delete only completed, cancelled, failed, or completed with errors processes. Running, paused, or waiting processes should not be deleted.
Use a threshold to delete only processes that are older than a specific time period, for example processes that are older than 12 months.
The following sample Scheme code deletes processes that are older than 1 year and are completed, cancelled, failed, or completed with errors.
In the Overviewtab, define SysBatchJob as the base class of the new class.
Override the run event and add a main action that contains the Scheme code that you created earlier:
Open the Eventstab. On the top half of the screen, next to the Eventslist, click the Override Base Events button .
In the Override Base Events dialog, add the run event.
In the Eventstab, in the Actionssubtab, click the Addbutton and select main.
In the Scriptsubtab, insert your Scheme code into the text field below the Methodfield.
Specify how often to run the batch job:
Open the Attributestab. On the top half of the screen, next to the Attributes list, click the Override Base Attributes button .
In the Override Base Attributes dialog, add the period event.
In the Attributes tab, in the Valuesubtab, in the Value field, specify the number of minutes between each invocation of the batch job. For example, specify 10080 to create a weekly batch job.
Seed the batch job:
In the Overviewtab, click the Selectbutton in the Aspectsfield.
In the Select Aspects dialog, include the PERSISTENCE_INITIALIZER aspect.
Open the Eventstab. On the top half of the screen, next to the Eventslist, click the Override Base Eventsbutton .
In the Override Base Events dialog, add the initializePersistence event.
In the Events list, select the initializePersistence event.
In the Eventstab, in the Actionssubtab, click the Addbutton and select main.
In the Scriptsubtab, insert Scheme code that seeds the batch job in the Conditionand Methodfields. For example:
In Condition, enter (null? (read-instance ProcessBatchJob '() '() #f))
In Method, enter ProcessBatchJob'new) (pre-commit)
Save and close the new class.
The batch job will be seeded the next time the server starts if the server is set to reseed.
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.