Basically i am struggling with understanding how to send and receive signals (messages) between different processes.
Could you please help me to design or give me a hints how to create in Eclipse Activiti Designer something like this:
Process "A": start-> User Task-> end.
process A has the data object: "invoiceId"=1
Process "B" start -> (Signal to Process "A" with invoiceId = "1") -> end
process B also has the data object: "invoiceId"=1
Use case would be approximately like that:
Process A registering new invoice and sends notification to user e.g: "New Incoming Invoice INV_1". The human task can be completed by the assignee OR it can receive a signal from another process and be auto completed.
Another process "B", lets say, it is a Payment receiving process. which received auto payment for an invoice 1. When the payment is received we need to signal Process A to complete.
I just cant find any tutorials of how to define a signal throwing and catching between two processes based on some kind of correlation id.
Maybe I'm missing something but your code appears to get a list of process executions that have a subscription to "globalSignalA" and individually "release" these by signalling them.
If his is truly a global signal, then setting the signal listeners to the default of "global" scope means that as soon as an intermediate send signal event is sent, all listeners will fire automatically. You really shouldnt need to write code to satisfy this use case.
No-no it is probably me who is missing something. What is a signal listener - have not found one in the activiti user guide, and how to make it to listen for the (global) signal also based on business key or some other correlation id?
I tried signalintermediatecatchevent and signal boundary events none of them fires when the other process throws the signal. (unless i do my groovy code).
Hi Greg, Thank you for the taking a look at my question and quick responses!
Well yes throwing and catching signals are working ok. But it seems not to be what i am asking for. I will try to rephrase, maybe i was not that clear at the first place.
Here is example and output from my processes.
What I am doing: (based on your proposed solution):
Process B starts -> sets business key id to '2'-> send HT to kermit (with boundry to global signal A)
Process A starts -> sets business key id to '1' -> throws (global singal A)
What I need: Process B with business key 2, stays active (is not receiving a signal), because it has different business identification.
What i got:
[Server:common-server] 10:50:42,989 [default task-27] INFO stdout - Process B (358392). Set Business key to: 2 [Server:common-server] 10:50:42,990 [default task-27] INFO stdout - Process B (358392). Sending H Task to mr. Kermit. [Server:common-server] 10:50:50,365 [default task-28] INFO stdout - Process A (358402). Set business key to: 1 [Server:common-server] 10:50:50,366 [default task-28] INFO stdout - Process A (358402). Sending signal... [Server:common-server] 10:50:51,070 [default task-28] INFO stdout - Process B (358392). Closing HT because signal is received. [Server:common-server] 10:50:51,072 [default task-28] INFO stdout - Process B (358392). By I am done. [Server:common-server] 10:50:51,231 [default task-28] INFO stdout - Process A (358402). Done.
Just to stress one more time - The main point in my requirement is that i need to send signals only and only to related (by some correlation id) processes. (not to all processes which are waiting for global signal). Meanwhile i don't see any other ops for that only but running kinda script i gave example earlier.