Don't just Queue it

Implementing asynchronous conversations on top of workflow is much easier than just using messaging.

Messaging is a solution to the problem of how two or more endpoints can communicate in an asynchronous way. This solves the problem of decoupling the endpoints from one another.

Workflow is a solution to the problem of how to track, coordinate and monitor long-running conversations which are composed of multiple asynchronous interactions.

Simple Exchanges

There are two endpoints which need to exchange data. Instead of communicating synchronously, the first endpoint creates a message and sends it via the intermediary of a messaging system:

See also: Enterprise Integration Patterns.

It is also possible to implement two-way interactions. This can be achieved using Request-Reply:

The first endpoint needs to correlate the Reply Message to the Request Message. This can be solved using different patterns such as Correlation Identifier.

More complex Conversations

Often more than two endpoints are exchanging messages.

Such conersations can be implemented using messaging. The resulting architecture is called Pipes and Filters.

There may also be a reply message:

Again, the messages need to be correlated.

Workflows

The more messages and endpoints are involved, the harder it gets to implement it purely on top of the “pipes and filters architecture”.

The solution to this is Workflow. Instead of sending the messages directly from one endpoint to another, they are routed through a workflow engine:

See also: Process Manager.

The workflow engine can

And most importantly: when using BPMN for modeling the workflow, the interaction is automatically documented by the means of a diagram which can be understood by business people, developers and operators.