When workflow extensions are enabled using default workflow executors, they create respective approval tasks in WSO2 Business Process Server (BPS). Each of these tasks are visible to administrators in the Admin Dashboard. The administrator has the option to accept or reject each of the requests made by other users. At the same time, users have the option to delete the application, subscription or key they created before the administrator accepts or rejects their requests. This leaves unnecessary approval requests in the Admin Dashboard, which can confuse the administrator.
API Manager provides a task clean up feature to prevent deleted items from showing up in the Admin Dashboard. The
WorkflowExecutor class is introduced with the
cleanUpPendingTask(String workflowExtRef) method, which is triggered by application or subscription deletion. This method implements the logic to notify WSO2 BPS that a task with the
workflowExtRef ID has been deleted.
The BPEL process in WSO2 BPS should contain a cancel event to support process cancellation. Each BPEL process should support correlation and event cancellation in order to successfully cleanup unnecessary tasks. For more information on BPEL correlation, see Process Correlation and the BPEL Correlation Guide.
The final BPEL should have a design similar to the following diagram,
Follow the steps below to test this out.
- Log in to the API Store and create two new applications.
- Log in to the Admin Dashboard Web application (
https://<Server Host>:9443/admin-dashboard) and approve the creation of one application.
- In the API Store, subscribe an API to the approved application.
- Generate production and/or sandbox key(s) for the approved application.
- Check the pending approval tasks in the Admin Dashboard. You see tasks pending for application creation, application registration and subscription creation.
- Delete the items you created from the API Store and notice that the respective administrator approval tasks are removed.
- If the application with pending subscription and key generation approvals is deleted from the API Store, all the pending subscription and key generation approval tasks are deleted for that application.