Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, Process P is listening to events E(A) and E(B), but to process either of the events, P needs the other event available too. Naively, when P receives either of the events, it will check if the other event is already received. If not, it can wait. But

1) this does not sound very efficient, especially when each process has many different types of events to process.

2) Also as the number of distributed processes increases to a large number, events are more tangled between processes, processes dies/restarts, etc. all these make the events handling more complicated.

So I would like to know if there are any reference doc / model/ implementations for events handling under such a distributed computing environment?

share|improve this question

You can manage this coordination using workflow/saga techniques.

Your process defines a workflow (state machine) that can be initiated on receipt of either E(A) or E(B).

For example: on receipt of E(A) your Process service initiates a workflow that begins waiting for a matching E(B) message. Subsequent receipt of E(B) message will resume the workflow originally started by E(A).

In between workflow initiation and resumption, you might consider storing workflow in persistent storage to survive termination of your Process service.

The documentation on Sagas (workflow) from NServiceBus explains this concept well.

share|improve this answer
Thanks for pointing out this pattern to me. just curious how this pattern would perform in a very performance demanding embeded environment. – wei Feb 7 '12 at 6:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.