IC SunsetThe developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this forum will no longer be available. More details available on our FAQ.
Topic
  • 9 replies
  • Latest Post - ‏2019-09-26T18:04:56Z by harishpandola
harishpandola
harishpandola
23 Posts

Pinned topic Event subprocess UCA does not get triggered

‏2019-08-26T01:42:53Z | bpm8.5.7 bpm8.6

Hi All,

 

I created a sample process to test Event sub process.My event subprocess has a message start event which should be triggered by the UCA attached to the message end event of the parent process.When I start the parent process and take it to completion i.e to message end event.The ESP never starts.Please refer the attached images for understanding the process.

Aldo,I observed that as soon as I start the parent process,a token activates to the ESP and it's start event,is it ok?

Any thought?

 

Thanks

 

 

Updated on 2019-08-26T01:44:13Z at 2019-08-26T01:44:13Z by harishpandola
  • QuikJean
    QuikJean
    133 Posts
    ACCEPTED ANSWER

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-27T08:29:26Z  

    Hi QuikJean,

     

    I made the changes suggested by you but when I execute the process.The token moves to the task after the "IME" and never executes the UCA in "ESP"(Event Subprocess).I am using the same variable for correlation so that can't be a problem.Anything else you observe here which could be causing issue?

    Please refer the latest attached image (ESP Issue 4.PNG) for reference.

     

    Thanks

    I have not thought of it in the first place but yeah there is another requirement.

    When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes.

    That means that the correlation key variable content cannot be set later than the "Start" activity : so either

    - by setting a default value to the correlation key variable (very good for tests like you do but then not good for prod because all the processes will have the same key)

    - by using an input variable content (good if your process already comes with pre-set values - as if this process was actually launched by another one or used as a linked process)

    - by using the process instance ID (tw.system.currentProcessInstance.id - which is of course unique for each instance so very handy if this is a top process)

    - by setting a PRE or POST variable in the Start activity (good if you need to concatenate some pre-set variables to build a unique key)

     

    Also you may want to remove the "durable subscription" checkbox : it stores in BPM DB the correlation key already sent and if later on a process matches again that key it would run the Subprocess again until the key is "consumed" (with another IME that has the checkbox "consum message" checked).

    It can bring unexpected behaviour if you reuse keywords as correlation key instead of a very unique key each time.

    If you expect a synchronous behaviour you don't want to check that box.

     

    I hope all that is clear, let me know if not

  • QuikJean
    QuikJean
    133 Posts
    ACCEPTED ANSWER

    Re: Event subprocess UCA does not get triggered

    ‏2019-09-23T10:26:32Z  

    Hi QuikJean,

     

    When you say "When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes."

    Does it mean,the event subprocess will not get triggered for the old/existing Instances, will it work only for the new instances?

     

    Thanks

    Good question !! I must say that I don't know but I would assume only new instances would work fine.

  • QuikJean
    QuikJean
    133 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-26T07:37:01Z  

    This is a race condition here : the "send" UCA is sent and because this is the end of the process, it automatically makes the process complete, and the UCA does not have time to trigger the Event process on time.

    You should add another human activity after the message is sent on the main flow if you want to play like that.

    In regards to the token that you see on the subprocess, this is normal, BPM is "on hold" on it until it receives something, that's a good way to know if BPM is still listening on the UCA or not (in the case it was not repeatable for example)

    Updated on 2019-08-26T07:37:46Z at 2019-08-26T07:37:46Z by QuikJean
  • harishpandola
    harishpandola
    23 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-26T13:52:56Z  
    • QuikJean
    • ‏2019-08-26T07:37:01Z

    This is a race condition here : the "send" UCA is sent and because this is the end of the process, it automatically makes the process complete, and the UCA does not have time to trigger the Event process on time.

    You should add another human activity after the message is sent on the main flow if you want to play like that.

    In regards to the token that you see on the subprocess, this is normal, BPM is "on hold" on it until it receives something, that's a good way to know if BPM is still listening on the UCA or not (in the case it was not repeatable for example)

    Hi QuikJean,

     

    I made the changes suggested by you but when I execute the process.The token moves to the task after the "IME" and never executes the UCA in "ESP"(Event Subprocess).I am using the same variable for correlation so that can't be a problem.Anything else you observe here which could be causing issue?

    Please refer the latest attached image (ESP Issue 4.PNG) for reference.

     

    Thanks

    Attachments

  • AndrewPaier
    AndrewPaier
    1198 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-26T15:57:14Z  

    Hi QuikJean,

     

    I made the changes suggested by you but when I execute the process.The token moves to the task after the "IME" and never executes the UCA in "ESP"(Event Subprocess).I am using the same variable for correlation so that can't be a problem.Anything else you observe here which could be causing issue?

    Please refer the latest attached image (ESP Issue 4.PNG) for reference.

     

    Thanks

    It is difficult to tell from the current diagram what exactly has happened.  Assuming your Event Sub Process is repeatable, the #4 token is going to stay there even if the ESP triggers.  If you replace your inline JS with a human task, I would expect that you would see the human task show up.  But as long as the thing you are doing in the ESP has no human activity, the only difference you would notice in the ESP is when the UCA triggers the SME, the "token" on the SME will change from a #5 to some other number because the #5 one moved forward to the JS and then the end, and a new token was created on the SME.

     

    Really unclear to me why you would use a UCA to tigger a JS Block, since you could just have changed your UCA invocation to be the JS Block from he ESP.

     

    -Andrew Paier

  • QuikJean
    QuikJean
    133 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-27T08:29:26Z  

    Hi QuikJean,

     

    I made the changes suggested by you but when I execute the process.The token moves to the task after the "IME" and never executes the UCA in "ESP"(Event Subprocess).I am using the same variable for correlation so that can't be a problem.Anything else you observe here which could be causing issue?

    Please refer the latest attached image (ESP Issue 4.PNG) for reference.

     

    Thanks

    I have not thought of it in the first place but yeah there is another requirement.

    When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes.

    That means that the correlation key variable content cannot be set later than the "Start" activity : so either

    - by setting a default value to the correlation key variable (very good for tests like you do but then not good for prod because all the processes will have the same key)

    - by using an input variable content (good if your process already comes with pre-set values - as if this process was actually launched by another one or used as a linked process)

    - by using the process instance ID (tw.system.currentProcessInstance.id - which is of course unique for each instance so very handy if this is a top process)

    - by setting a PRE or POST variable in the Start activity (good if you need to concatenate some pre-set variables to build a unique key)

     

    Also you may want to remove the "durable subscription" checkbox : it stores in BPM DB the correlation key already sent and if later on a process matches again that key it would run the Subprocess again until the key is "consumed" (with another IME that has the checkbox "consum message" checked).

    It can bring unexpected behaviour if you reuse keywords as correlation key instead of a very unique key each time.

    If you expect a synchronous behaviour you don't want to check that box.

     

    I hope all that is clear, let me know if not

  • harishpandola
    harishpandola
    23 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-27T19:46:21Z  
    • QuikJean
    • ‏2019-08-27T08:29:26Z

    I have not thought of it in the first place but yeah there is another requirement.

    When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes.

    That means that the correlation key variable content cannot be set later than the "Start" activity : so either

    - by setting a default value to the correlation key variable (very good for tests like you do but then not good for prod because all the processes will have the same key)

    - by using an input variable content (good if your process already comes with pre-set values - as if this process was actually launched by another one or used as a linked process)

    - by using the process instance ID (tw.system.currentProcessInstance.id - which is of course unique for each instance so very handy if this is a top process)

    - by setting a PRE or POST variable in the Start activity (good if you need to concatenate some pre-set variables to build a unique key)

     

    Also you may want to remove the "durable subscription" checkbox : it stores in BPM DB the correlation key already sent and if later on a process matches again that key it would run the Subprocess again until the key is "consumed" (with another IME that has the checkbox "consum message" checked).

    It can bring unexpected behaviour if you reuse keywords as correlation key instead of a very unique key each time.

    If you expect a synchronous behaviour you don't want to check that box.

     

    I hope all that is clear, let me know if not

    Thanks a lot for your detailed explanation 

    My issue got fixed with your suggestions.Learned a lot about ESP.I don't think I will ever have any issue with UCAs now. :)

  • harishpandola
    harishpandola
    23 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-08-27T19:48:47Z  

    It is difficult to tell from the current diagram what exactly has happened.  Assuming your Event Sub Process is repeatable, the #4 token is going to stay there even if the ESP triggers.  If you replace your inline JS with a human task, I would expect that you would see the human task show up.  But as long as the thing you are doing in the ESP has no human activity, the only difference you would notice in the ESP is when the UCA triggers the SME, the "token" on the SME will change from a #5 to some other number because the #5 one moved forward to the JS and then the end, and a new token was created on the SME.

     

    Really unclear to me why you would use a UCA to tigger a JS Block, since you could just have changed your UCA invocation to be the JS Block from he ESP.

     

    -Andrew Paier

    Thanks Andrew for your response.Probably,you are referring to my earlier implementation where I used JS Block to fire the UCA as the Message end event was not working but my issue is fixed now with QuickJean's suggestions.

  • harishpandola
    harishpandola
    23 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-09-11T02:33:28Z  
    • QuikJean
    • ‏2019-08-27T08:29:26Z

    I have not thought of it in the first place but yeah there is another requirement.

    When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes.

    That means that the correlation key variable content cannot be set later than the "Start" activity : so either

    - by setting a default value to the correlation key variable (very good for tests like you do but then not good for prod because all the processes will have the same key)

    - by using an input variable content (good if your process already comes with pre-set values - as if this process was actually launched by another one or used as a linked process)

    - by using the process instance ID (tw.system.currentProcessInstance.id - which is of course unique for each instance so very handy if this is a top process)

    - by setting a PRE or POST variable in the Start activity (good if you need to concatenate some pre-set variables to build a unique key)

     

    Also you may want to remove the "durable subscription" checkbox : it stores in BPM DB the correlation key already sent and if later on a process matches again that key it would run the Subprocess again until the key is "consumed" (with another IME that has the checkbox "consum message" checked).

    It can bring unexpected behaviour if you reuse keywords as correlation key instead of a very unique key each time.

    If you expect a synchronous behaviour you don't want to check that box.

     

    I hope all that is clear, let me know if not

    Hi QuikJean,

     

    When you say "When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes."

    Does it mean,the event subprocess will not get triggered for the old/existing Instances, will it work only for the new instances?

     

    Thanks

  • QuikJean
    QuikJean
    133 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-09-23T10:26:32Z  

    Hi QuikJean,

     

    When you say "When the Event Subprocess IME is initiated, it reads the correlation key content to start watching for that content BUT it will NOT watch for content changes."

    Does it mean,the event subprocess will not get triggered for the old/existing Instances, will it work only for the new instances?

     

    Thanks

    Good question !! I must say that I don't know but I would assume only new instances would work fine.

  • harishpandola
    harishpandola
    23 Posts

    Re: Event subprocess UCA does not get triggered

    ‏2019-09-26T18:04:56Z  
    • QuikJean
    • ‏2019-09-23T10:26:32Z

    Good question !! I must say that I don't know but I would assume only new instances would work fine.

    Yes I tested this with old instances,it doesn't work as the old instances does not have the context or active token for the newly added Event subprocess.