Problem with Cancelling a Human Task in a BPM Process

来源:互联网 发布:ff14蒂法捏脸数据 编辑:程序博客网 时间:2024/04/29 09:30

Problem with Cancelling a Human Task in a BPM Process

此问题未回答

Nasser FardNewbie

    Hey everyone,

     

    I have got an issue in cancelling a Human task which is located inside a BPM Process. Assume we have a Human Task (HT) in a BPM process (P1). This Human Task can be assigned to a user based on his role and he can see that in his inbox. But, sometimes we need to cancel the assigned Human Task so that an external process (P2) can interrupt an instance of P1 and cancel (or in another word "Withdraw") the Human Task. In this case, the HT will be disappeared from user's inbox.

     

    To do that, I have used "Event SubProcess" activity (SP1). A correlation is defined in start node of P1 (Message Start) to initiatialise the correlation key (correlaion mode is "Initialise") and the other one is defined in Start Node of "Event Subprocess", SP1, but set as "Uses" mode.

     

    The normal flow works abosolutely fine here, so that if P1 process kicked off from Main Node, the process stops at Human Task and wait for the user's action. And also, if external process, P2, send cancellation message (using Send Activity) it withdraws the Human Task as well and Human Task will pulled out of user inbox. Perfect!

     

    But, the problem starts if we reverse the events order. If the Cancel message happens first, the message will be waiting untill the new process comes in, them it interrupts and cancels its task. So, if a new P1 created through main node after cancel message, it will be automatically go through Event Subprocess path and therefore the Human Task will be cancelled without going to user's inbox!

     

    As said, the way to send the cancel message is implemented using Send Activity. Not sure why it keeps cancel message, I want it to be ignored if there is not any process instance created before.

    This approach has been re-implemented using Events (throw signal to send cancel, and start Node in SP1 changed to signal).

     

    Any idea to ignore these kind of messages/events?

     

    Thanks,

    Nasser

    平均用户评级: 无评分 (0 评级)
    平均用户评级
    无评分
    (0 评级)
      • 1. Re: Problem with Cancelling a Human Task in a BPM Process
        Daniel AtwoodOracle ACE

        Where you have:

        But, the problem starts if we reverse the events order. If the Cancel message happens first, the message will be waiting untill the new process comes in, them it interrupts and cancels its task. So, if a new P1 created through main node after cancel message, it will be automatically go through Event Subprocess path and therefore the Human Task will be cancelled without going to user's inbox!

        You might want to consider checking to see if the correlation exists before sending the cancel.  The easiest way to do this that I've seen is to use the human workflow service API to:

        1. As the work item enters the human task your main process where the correlation was initialized, set a flex field.  This gives you an easy way to use the API to search to see if it exists.
        2. From your calling process call the HWS API and create a clause that sets the "columnName" attribute to the name of the flex field, set the "operator" to "EQ", and set the "value" to your correlation id.  Add another clause that is a joinOperator="AND" clause and set its column name to "state" and its operator to "IN" and set the valueList to these values:  "ASSIGNED", INFO_REQUESTED" and "OUTCOME_UPDATED".
        3. Invoke this service from the calling process before you attempt to cancel the work item.  Add a timer event that follows this service and set it to 3 seconds so dehydration occurs.  If it's ok, the value returned in the service response's "taskListResponse.task[1].systemMessageAttributes.textAttribute1 field (where "textAttribute1" was the flex field that was set in the other process) will be equal to your correlation key.  Use this in an exclusive gateway to see if the correlation exists and the instance is in the human task.  If it is, then send your cancel.

         

        I've heard that they've simplified this in 12c, but that's how I've seen it done in 11g.

         

        Hope this gets you going,

        Dan

        • 2. Re: Problem with Cancelling a Human Task in a BPM Process
          Nasser FardNewbie

          Hi Dan,

           

          Thanks for your response. I didn't have a chance to test it yet, but believe this is fine solution to go. We have also considered a custom Task table in our application that matches to the Human Tasks. So, another possibility is going into application database and see whether the task is already created or not.

          Thanks once again and I will update this thread as soon as I got this tested.

          Cheers,

          Nasser

          0 0
          原创粉丝点击