We have a requirement to implement a service which must wait for another, independently invoked, service to execute before proceeding. We were looking at the pub.sync:wait and pub.sync:notify services but, if I understand them correctly, they do not work in a clustered environment where the waiting service could be on node 1 and the notifying service on node 2. Is there an equivalent for clustered environments?
I´m not sure what you implementation looks like, and I´ve never used the pub.sync:wait/notify services. But (depending on your implementation) maybe you can solve it using a join condition?
- Execute Service A
- Execute Service B (independently)
- When Service A is finished (or when it should wait for service B), publish a doc (docA) and wait (pub.publish:waitForReply)
- When Service B is finished, it publishes a document (docB)
- A special trigger which joins docA and docB invkoes Service C which does something and published a reply document which service A can listen for.
- When Service A gets the reply doc, it continues its invocation.
Or - if you do not have to return the control to Service A, maybe Service C can continue where Service A stopped.
Just an idéa - I guess there are numerous ways to solve this.
Did it get any clearer or did I just mess your mind up even more?
We found a way around it. If the notify service returns no services notified we do a remote invoke of a service on the other node in the cluster to try a notify there.