Reputation: 887
What is the difference between using a private flow using flow-ref to refernce another flow or using vm endpoints in request-response style?
They both get their own processing, threading and exception strategy? Is there a benefit or rule when to use one over the other?
Upvotes: 4
Views: 5507
Reputation: 10
An asynchronous flow is a flow which by default (but not necessarily) is executed asynchronously and VM is a transport based on queues.
What you probably means is what's the difference between invoking an asynchronous flow via flow-ref or doing it through a VM queue.
flow-ref will pass the same event and message for processing. If the flow is asynchronus, then by default that will happen on a different thread and Mule will make a copy of the event to prevent interference between threads. In certain conditions (for example, there's an active transaction) Mule might choose to execute synchronously despite the flow's configuration. All of this happens in memory, which means that if the server crashes you might loose the message.
VM is a transport, which means that each flow will get a copy of the same event but different messages. All the outbound properties of the sender will become the inbound properties of the receiver. Synchronicity is not up to the flow's configuration but on the selected exchange pattern. Additionally, you can configure VM to use persistent queues and transactions, which would assure zero message loss when used properly.
Upvotes: 0
Reputation: 4551
From Mule In Action 2nd ed: Before Mule3, a lot of VM endpoints were used to tie services together. But since Mule 3, another option for sharing flows is available called private flows
.
Private flows are another type of reusable flows, much similar to sub-flows but with a very different behavior in term of threading and exception handling. The primary reason for using a private flow instead of a sub-flow is to define in it a different exception strategy than from the calling flow (something that is impossible with a sub-flow).
When a sub-flow
is invoked the execution behaves as if the message processors of the sub-flow were actually located in the
calling flow. With a private flow, the execution behaves as if a message was passed
from the calling flow to the private flow. This decoupling allows defining
processing and error handling strategies that are local to the private flow.
I think private-flow
is new approach to handle request-response without using vm end-point and provides re-usability
of sub-flow
with add-on of exception-handling
and processing-strategy
Upvotes: 8
Reputation: 33413
The main differences are:
Upvotes: 7