Batch Finish Approve/Reject Trigger

General

When a user selects multiple items in a task and do Finish/Approve or Finish/Reject operation, multiple responses(one for each item) are sent to AVOS/BPM. We can batch/group these responses and send only a single response(which contain details of all the items) back to BPM.

Enable Batching

To enable batching for Finish/Approve or Finish/Reject response, we need to take care of following things :

  1. Message Queue communication mode should be enabled between P360 and BPM. Batching will not work with REST based communication.

  2. Process Identifier(processId) in the request payload for enterWorkflowStatus ( V1.0/manage/workflow/status/enter) should be appended as a prefix with BATCH (case insensitive) keyword. Please refer the screenshot below.

    images/download/attachments/304249877/image2020-11-22_20-43-4.png

Batching is optional. If batching is not enabled, BPM will receive multiple messages each with one item.

Batching Parameter

Batching is done based on a threshold parameter named Workflow items batch threshold. This threshold specifies the size in terms of number of items in a batch after which it is executed as a group.

  • Default Value
    Default value for this parameter is 1000.


    workflow.items.batch.threshold=1000
  • Custom Value at Runtime

To change this parameter at runtime, MXBeans are used which allow this value to be updated from JConsole and does not require server restart.

images/download/attachments/304249877/image2020-10-28_16-26-37.png

Number of messages received by BPM depends on batch threshold and number of items selected together for Approve/Reject operation. If number of items selected are less than batch threshold, BPM will receive 1 message with all items. But if number of items selected are more than threshold, multiple messages will be received. For example, if batch threshold is 1000 and user selected 1500 items, BPM will receive 2 messages, one with 1000 items and other with 500 items.

BPM Payload with Batching

  • Finish/Approve Trigger

Parameter

Description

decision id

decision id for approve/finish decision.

processStatusInfo's

group of process status info objects each having information for an individual item

Parameter

Description

processIdentifier

process Id with BATCH prefix keyword

itemEntity

Entity for item

item

internal identifier with catalog id

itemExternalIdentifier

external identifier for an item

statusEntry

status entry attributes

Approve Trigger Payload
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<decisions>
<decision id="p360.bpm.approve"/>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>11@1</item>
<itemExternalIdentifier>Article_1603223965867005</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>user</name>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:34:31:620-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>1</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
</attribute>
<attribute>
<name>deadline</name>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
</attribute>
<attribute>
<name>modificationUser</name>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>10@1</item>
<itemExternalIdentifier>Article_1603223965867004</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-22T14:11:01:590-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>user</name>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:34:31:620-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>4</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
</attribute>
<attribute>
<name>deadline</name>
<value>2020-10-22T14:15:23:220-0400</value>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-22T14:11:01:620-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>modificationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>16@1</item>
<itemExternalIdentifier>Article_1603223965880002</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>user</name>
<value>100</value>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:34:31:620-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>1</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
<value>2020-10-28T16:34:31:643-0400</value>
</attribute>
<attribute>
<name>deadline</name>
<value>2020-10-28T16:34:31:600-0400</value>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
<value>2020-10-28T16:34:31:640-0400</value>
</attribute>
<attribute>
<name>modificationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>20@1</item>
<itemExternalIdentifier>Article_1603223965881002</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>user</name>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:34:31:620-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>1</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
</attribute>
<attribute>
<name>deadline</name>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
</attribute>
<attribute>
<name>modificationUser</name>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
</decisions>
  • Finish/Reject Trigger

Parameter

Description

decision id's

group of all decision id's selected for rejecting a task

processStatusInfo's

group of process status info objects each having information for an individual item

Parameter

Description

processIdentifier

process Id with BATCH prefix keyword

itemEntity

Entity for item

item

internal identifier with catalog id

itemExternalIdentifier

external identifier for an item

statusEntry

status entry attributes

Reject Trigger Payload
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<decisions>
<decision id="decision1-id"/>
<decision id="decision2-id"/>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>20@1</item>
<itemExternalIdentifier>Article_1603223965881002</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:35:16:107-0400</value>
</attribute>
<attribute>
<name>user</name>
<value>100</value>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:35:33:844-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>2</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>deadline</name>
<value>2020-10-28T16:35:33:843-0400</value>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>modificationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>11@1</item>
<itemExternalIdentifier>Article_1603223965867005</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:35:16:107-0400</value>
</attribute>
<attribute>
<name>user</name>
<value>100</value>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:35:33:844-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>2</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>deadline</name>
<value>2020-10-28T16:35:33:843-0400</value>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>modificationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>16@1</item>
<itemExternalIdentifier>Article_1603223965880002</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-28T16:33:50:610-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:35:16:107-0400</value>
</attribute>
<attribute>
<name>user</name>
<value>100</value>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:35:33:844-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>2</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>deadline</name>
<value>2020-10-28T16:35:33:843-0400</value>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-28T16:33:50:640-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>modificationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
<processStatusInfo>
<processIdentifier>batch4712</processIdentifier>
<itemEntity>Article</itemEntity>
<item>10@1</item>
<itemExternalIdentifier>Article_1603223965867004</itemExternalIdentifier>
<statusEntry>
<attribute>
<name>workflow.identifier</name>
<value>WorkflowTask1</value>
</attribute>
<attribute>
<name>workflow</name>
<value>1</value>
</attribute>
<attribute>
<name>status</name>
<value>Status1</value>
</attribute>
<attribute>
<name>startTime</name>
<value>2020-10-22T14:11:01:590-0400</value>
</attribute>
<attribute>
<name>lastStartTime</name>
<value>2020-10-28T16:35:16:107-0400</value>
</attribute>
<attribute>
<name>user</name>
<value>100</value>
</attribute>
<attribute>
<name>userGroup</name>
</attribute>
<attribute>
<name>supplier</name>
</attribute>
<attribute>
<name>endTime</name>
<value>2020-10-28T16:35:33:844-0400</value>
</attribute>
<attribute>
<name>duration</name>
<value>0</value>
</attribute>
<attribute>
<name>visitCounter</name>
<value>5</value>
</attribute>
<attribute>
<name>errorMessage</name>
<value>No error</value>
</attribute>
<attribute>
<name>acceptDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>deadline</name>
<value>2020-10-28T16:35:33:843-0400</value>
</attribute>
<attribute>
<name>creationDate</name>
<value>2020-10-22T14:11:01:620-0400</value>
</attribute>
<attribute>
<name>creationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>modificationDate</name>
<value>2020-10-28T16:35:33:850-0400</value>
</attribute>
<attribute>
<name>modificationUser</name>
<value>100</value>
</attribute>
<attribute>
<name>hint</name>
<value>Comment for Status1</value>
</attribute>
</statusEntry>
</processStatusInfo>
</decisions>