Topic
  • 4 replies
  • Latest Post - ‏2013-07-15T07:43:23Z by tarqe39
tarqe39
tarqe39
9 Posts

Pinned topic Message Event conditional execution

‏2013-06-20T09:24:25Z | event message uca

Hi, i have a problem with referencing a mapped variable from the attached message UCA. Problem is that i have a correlation key and another variable that is suppose to do additional conditional checks before the message is triggered. 

How to use the variable before its mapped to a tw.local.XXX variable?

condition is something like this;

tw.local.activityToIgnoreId!=tw.local.activity.id

where tw.local.activityToIgnore should be mapped from UCA message, but its undefined

Thanks!

Updated on 2013-06-20T11:28:57Z at 2013-06-20T11:28:57Z by tarqe39
  • AndrewPaier
    AndrewPaier
    1066 Posts
    ACCEPTED ANSWER

    Re: Message Event conditional execution

    ‏2013-07-08T20:10:25Z  
    • tarqe39
    • ‏2013-07-04T14:25:16Z

    Very nice post, but it doesnt cover my problem.

    Lets say i want to kill all related external activities but the one that sent the message. So, i have a process instance A that sends out a message, but i want to make sure that message doesnt interrupt task on the process instance A. It should interrupt tasks on all the other instances. The problem is that token can get to the task before message does, so what happens is that task gets interrupted "by itself".

    So i would need some kind of inverse correlation so instead of == correlation it should be something like !=. Problem is that in the conditional block the variables that came with the message arent mapped yet so i cannot use them. And the correlation value checks only for equality.

    Well, there isn't a good way to do this OOTB, but you could try either a redesign, or perhaps cheating.

    Redesign -

    From reading your response it feels like you have N instances of process(es) all with tokens on their activities and waiting for a UCA to trigger them.  Unfortunately for some reason they all have the same correlation ID (that seems broken to me, but I'll take it as a given for this scenario).  If you moved to using the REST API to close out the tasks, rather than using the shot gun of a UCA.  You might also be able to use the JS API to do this, but I haven't looked in a while.  Basically you would get a list of all the tasks on the instances that don't match your instance (but otherwise match your correlation value) and issue a close task to each. 

    Redesign 2 -

    Put a decision gateway after the event message.  Modify the event to send the ID of the instance you don't want to have move.  Have the IME (using the modified UCA) to to a decision gateway  and route back to the task (the task_id will change.  Hope that isn't a problem).  This will make all the ones with a different instance ID go a different route.

    Redesign 3 -

    Find a better correlation ID.

    Cheating -

    So, same setup.  But we apparently want the task on A to stay active.  If we make the UCA's non durable then if the activity we want closes and calls the UCA and then loops back to the task, then all of the other waiting instances will get the UCA call, but the newly created task from the loop back will not be listening when the UCA triggers, so it should not close the task.  Possible timing issue here though, depending on how loaded the event manager is.

    Andrew Paier  |  Director  |  BP3 Global, Inc.
    BP3 Global's Website  |  Twitter  |  Linkedin  |  Google+  |  Blogs

  • AndrewPaier
    AndrewPaier
    1066 Posts

    Re: Message Event conditional execution

    ‏2013-06-25T17:17:54Z  

    Correlation can get rather complex.  I've written a Blog post about some options for this and posted it here.  Let me know if that helps.  If you give us more specifics about what you need to do, we might be able to better answer the question.

  • tarqe39
    tarqe39
    9 Posts

    Re: Message Event conditional execution

    ‏2013-07-04T14:25:16Z  

    Correlation can get rather complex.  I've written a Blog post about some options for this and posted it here.  Let me know if that helps.  If you give us more specifics about what you need to do, we might be able to better answer the question.

    Very nice post, but it doesnt cover my problem.

    Lets say i want to kill all related external activities but the one that sent the message. So, i have a process instance A that sends out a message, but i want to make sure that message doesnt interrupt task on the process instance A. It should interrupt tasks on all the other instances. The problem is that token can get to the task before message does, so what happens is that task gets interrupted "by itself".

    So i would need some kind of inverse correlation so instead of == correlation it should be something like !=. Problem is that in the conditional block the variables that came with the message arent mapped yet so i cannot use them. And the correlation value checks only for equality.

  • AndrewPaier
    AndrewPaier
    1066 Posts

    Re: Message Event conditional execution

    ‏2013-07-08T20:10:25Z  
    • tarqe39
    • ‏2013-07-04T14:25:16Z

    Very nice post, but it doesnt cover my problem.

    Lets say i want to kill all related external activities but the one that sent the message. So, i have a process instance A that sends out a message, but i want to make sure that message doesnt interrupt task on the process instance A. It should interrupt tasks on all the other instances. The problem is that token can get to the task before message does, so what happens is that task gets interrupted "by itself".

    So i would need some kind of inverse correlation so instead of == correlation it should be something like !=. Problem is that in the conditional block the variables that came with the message arent mapped yet so i cannot use them. And the correlation value checks only for equality.

    Well, there isn't a good way to do this OOTB, but you could try either a redesign, or perhaps cheating.

    Redesign -

    From reading your response it feels like you have N instances of process(es) all with tokens on their activities and waiting for a UCA to trigger them.  Unfortunately for some reason they all have the same correlation ID (that seems broken to me, but I'll take it as a given for this scenario).  If you moved to using the REST API to close out the tasks, rather than using the shot gun of a UCA.  You might also be able to use the JS API to do this, but I haven't looked in a while.  Basically you would get a list of all the tasks on the instances that don't match your instance (but otherwise match your correlation value) and issue a close task to each. 

    Redesign 2 -

    Put a decision gateway after the event message.  Modify the event to send the ID of the instance you don't want to have move.  Have the IME (using the modified UCA) to to a decision gateway  and route back to the task (the task_id will change.  Hope that isn't a problem).  This will make all the ones with a different instance ID go a different route.

    Redesign 3 -

    Find a better correlation ID.

    Cheating -

    So, same setup.  But we apparently want the task on A to stay active.  If we make the UCA's non durable then if the activity we want closes and calls the UCA and then loops back to the task, then all of the other waiting instances will get the UCA call, but the newly created task from the loop back will not be listening when the UCA triggers, so it should not close the task.  Possible timing issue here though, depending on how loaded the event manager is.

    Andrew Paier  |  Director  |  BP3 Global, Inc.
    BP3 Global's Website  |  Twitter  |  Linkedin  |  Google+  |  Blogs

  • tarqe39
    tarqe39
    9 Posts

    Re: Message Event conditional execution

    ‏2013-07-15T07:43:23Z  

    Well, there isn't a good way to do this OOTB, but you could try either a redesign, or perhaps cheating.

    Redesign -

    From reading your response it feels like you have N instances of process(es) all with tokens on their activities and waiting for a UCA to trigger them.  Unfortunately for some reason they all have the same correlation ID (that seems broken to me, but I'll take it as a given for this scenario).  If you moved to using the REST API to close out the tasks, rather than using the shot gun of a UCA.  You might also be able to use the JS API to do this, but I haven't looked in a while.  Basically you would get a list of all the tasks on the instances that don't match your instance (but otherwise match your correlation value) and issue a close task to each. 

    Redesign 2 -

    Put a decision gateway after the event message.  Modify the event to send the ID of the instance you don't want to have move.  Have the IME (using the modified UCA) to to a decision gateway  and route back to the task (the task_id will change.  Hope that isn't a problem).  This will make all the ones with a different instance ID go a different route.

    Redesign 3 -

    Find a better correlation ID.

    Cheating -

    So, same setup.  But we apparently want the task on A to stay active.  If we make the UCA's non durable then if the activity we want closes and calls the UCA and then loops back to the task, then all of the other waiting instances will get the UCA call, but the newly created task from the loop back will not be listening when the UCA triggers, so it should not close the task.  Possible timing issue here though, depending on how loaded the event manager is.

    Andrew Paier  |  Director  |  BP3 Global, Inc.
    BP3 Global's Website  |  Twitter  |  Linkedin  |  Google+  |  Blogs

    Thank you for the reply.

    Our workaround was the Redesign 2 even before your first reply. It may not be the best solution because of the Due Date of the External Activity tasks and technically it is not the same task so it may introduce some problems further. I was hoping for the way to invert the correlationId, but it seeems there is no such option.

    FYI - setup is something like this:

    Pn - process instance n

    Cn - CorrelationId n

    Pn(Cn) - Process Instance n has the CorrelytionId n

    So for the Pn(Cn) i want to kill all the Pm(Cm) where m != n

    Hope this makes it clearer.