Skip to content

awnz/bonita-purge-tool

 
 

Repository files navigation

bonita-purge-tool

Build

This tool provides the capability to purge finished (archived) process instances from Bonita Runtime environment. By default, all archives are preserved forever in Bonita runtime, but if your functional context allows you to remove old unused process instances, as example, if you only need to keep a history of last 6 months, use this tool to cleanup your Bonita database.

How to use this tool

Build this tool

Bonita Purge Tool uses gradle & spring boot to build. Before building, it's recommended to modify the application.properties file located in src/main/resources to enter your database connection information.

Make sure you have Java 8+ installed and simply run: ./gradlew bootDistZip

Run the tool

# Unzip the previously built tool:
unzip -d . build/distributions/bonita-purge-tool.zip
# go to the tool folder:
cd bonita-purge-tool/
# run the command-line tool:
bin/bonita-purge-tool(.bat) <PROCESS_DEFINITION_ID> <OLDEST_DATE_TIMESTAMP> [<TENANT_ID>]

This command will delete all archived process instances belonging to the process identified by PROCESS_DEFINITION_ID, that are finished since at least OLDEST_DATE_TIMESTAMP.

An optional TENANT_ID parameter can be given if the platform uses multiple tenants to specify on which tenant should the process instances be deleted. If multi-tenancy is used and the TENANT_ID is not set, an error is issued and the program stops.

OLDEST_DATE_TIMESTAMP must be a Timestamp (in milliseconds) from which all process instances that finished before that date will be deleted. Unfinished process instances and process instances that finished after that date will not be affected. Its format is a standard Java timestamp since EPOCH (in milliseconds). You can use websites such as Epoch Converter to format such a timestamp.

Developer's corner

Run the unit tests

./gradlew test

Run the integration tests

Integration tests rely on database docker images that are only available for internal Bonitasofter's for now.

./gradlew integrationTest

or

./gradlew iT

to specify the database vendor on which to run the integration tests add -Ddb.vendor=<DB_VENDOR>. For instance:

./gradlew iT -Ddb.vendor=mysql

valid DB vendor values are: mysql | oracle | postgres | sqlserver.
If not specified, it will start a Postgres docker container and run tests against it.

Run the tool without building the whole package

./gradlew bootRun -Pargs=8901055312492483521,165000000,1

It runs on PostgreSQL by default. Change the default database parameters to run it on your database.

Database deletion volume testing reference

This reference page provides the tests run on all supported databases.

About

Tool that purges finished (archived) process instances older that a defined date

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 52.7%
  • TSQL 35.7%
  • Groovy 11.6%