Delete JBPM Workflows from Alfresco

Alfresco support JBPM workflows to leverage and streamline business processes. It will increase the security, reduce paper work, allow quick turnaround time, and many more advantages. So, for any organization which is using Alfresco for storing their content, they should take advantage of Alfresco workflows to implement business processes in it.

In WCM module of alfresco workflows are used as part of publishing process where content goes through various approval before final approval so that proofing and other correction and require approval could be embedded as part of workflow.Sometimes we have a situation where after creating many instances of workflows it seems stuck/stranded and we cannot deploy content, How to remove/delete WCM/AVM workflows? Stranded workflow can be caused by a number of reasons to include: deleting a user from Alfresco without first removing user from all web projects they are assigned to and without ending all the workflows they started or are tasked on; using “delete” workflow instead of “end” workflow will strand a WCM/AVM workflow; any disruption in workflow such as system crash.

Workflow stores will temporarily be shown in the Alfresco UI

(/alfresco)> “Admin Console” > “Node Browser” list while workflow is running.

They have the format  “avm://<storename>–workflow-<workflowsid>”.

Caution:

  • Take a full “cold” backup of your repository before trying this.
  • Test this in a test environment before implementing it on production.
  • Deletion of stores incorrectly or incorrect ones can permanently disable your web project and repository.

This is how we could solve above issue.

Step1:

Try to properly end workflows with the workflow console:

As ‘admin’ user

  • login to the workflow console

http://<host>:<port>/alfresco/faces/jsp/admin/workflow-console.jsp

Step2:  list all workflows entering command

show workflows all

Example results:

Last command: show workflows all
Duration:
148ms

id: jbpm$8 , desc: initial file uploads , start date: 2013-11-27 16:17:9.0 , def: jbpm$wcmwf:submit v1
id: jbpm$9 , desc: deploy something , start date: 2013-13-11 13:14:29.0 , def: jbpm$wcmwf:submit v1

Step3:

end each workflow using command

end workflow  <workflowid>

ex.

end workflow jbpm$8

  • check workflows are no longer with “show workflows all”
  • check the Alfresco UI > “Admin Console” >”Node Browser”” see if all workflow nodes are gone

If, there  workflows will not “end” and the workflow stores are still stranded in the node browser then you will need to:

Alternate Workaround steps(Specific to WCM only)

  1. Delete the sandboxes/stores using AVM console
  2. Delete the workflows using workflow console
  3. Restart Alfresco

Using the list of workflow sandboxes/stores from the “Node Browser” as reference:

ex (list of “Node Browser” workflow stores).

avm://mywebproject--workflow-4d88168e-2faf-4a21-n8d4-68f8cc7fb666
avm://mywebproject--workflow-4d88168e-2faf-4a21-n8d4-68f8cc7fb666--preview
avm://mywebproject--workflow-3f4c1e50-79a2-4069-a166-baf0dbc5013c
avm://mywebproject--workflow-3f4c1e50-79a2-4069-a166-baf0dbc5013c--preview

 

  • log in to “AVM console”

http://{host}:{port}/alfresco/faces/jsp/admin/avm-console.jsp

  •  remove stranded workflow nodes, execute

rmrep, <storename>

ex.

rmrep, mywebproject–workflow-3d88168e-2faf-4a41-a8d4-68f8cc7fb598
rmrep, mywebproject–workflow-3d88168e-2faf-4a41-a8d4-68f8cc7fb598–preview

  • Using the “Node Browser” click on the “refresh view” link in the top left corner  to confirm the workflow store was removed
  • repeat removal for all workflow stores listed in the “Node Browser” with the “AVM console”
  • validate using the “workflow console” and “show workflows all” command if there are any workflows remaining
  • If all the workflow stores are removed from the “AVM console” and you still have workflows listed in the “workflow console”, use the delete command in “workflow console” to remove the remaining workflows

delete workflow <workflowid>

ex.

delete workflow jbpm$8

  • repeat delete for each workflow to be deleted
  • Check all workflows gone (using the workflow console list all workflows)
  • Check all workflow stores gone (Using the node browser validate that the workflow stores are no longer listed)
  • restart Alfresco application server

For deleting workflow on normal Document Management module you can follow initial step 1 to 3.

We also need to take care once workflow is in production disable the new version of workflow by putting redeploy as false as shown below

<bean parent="workflowDeployer">

        <property name="workflowDefinitions">

            <list>

                <props>

                    <prop key="engineId">jbpm</prop>

                    <prop key="location">alfresco/workflow/custom_workflowedef.xml</prop>

                    <prop key="mimetype">text/xml</prop>

                    <prop key="redeploy">false</prop>

                </props>
       </list>

   </property>

</bean>

Summary:

These are few tips of JBPM workflow administration for alfresco system especially these tips will be helpful in system which are into production. Fell free to comment for any of your questions.

Further reading
Workflow console:  http://wiki.alfresco.com/wiki/Workflow_Console
AVM Console:  http://wiki.alfresco.com/wiki/AVM_Console

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 9 = 17

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>