What is the difference between a private stream using stream-ref or using vm endpoints request-response?

What is the difference between using a private stream using ref-ref to refer to another stream or using vm endpoints in request-response style?

Do they both get their own handling, threads and exception strategy? Is there an advantage or rule when to use one over the other?

+4
source share
3 answers

The main differences:

  • Propagation of properties must be addressed using the VM endpoint: you need to take care of copying properties from the inbound areas if you want them to be available on the other side of the VM endpoint.
  • The VM connector thread pool is used for the endpoint of the virtual machine, while the global one is used for the default processing strategy of the thread or user defined.
+7
source

From Mule In Action 2nd ed: To Mule3, many VM endpoints were used to link services. But, since Mule 3, another option is available for exchanging flows called private flows .

Private streams are another type of reusable streams, very similar to sub-streams, but with very different behavior in the field of stream processing and exception handling. The main reason for using a private stream instead of a subflow is to define a different exclusion strategy in it than from the calling stream (something that is not possible with the subflow).

When a sub-flow is called, execution behaves as if the sub-flow stream message handlers were actually located in the calling thread. Using a private thread, execution behaves as if the message was transferred from the calling thread to the private thread. This decoupling allows you to define error handling and processing that are local to the private thread.

I think private-flow is a new approach for processing a request-response without using a vm endpoint and provides re-usability of sub-flow with an exception-handling and processing-strategy add processing-strategy

+8
source

An asynchronous thread is a thread that, by default (but not necessarily), runs asynchronously, and a VM is a queue-based transport.

What you probably have in mind is that the difference is between invoking the asynchronous stream through ref-ref or executing it through the VM queue.

flow-ref will send the same event and message for processing. If the stream is asynchronous, then by default this will happen on another thread, and Mule will make a copy of the event to prevent interference between the threads. Under certain conditions (for example, there is an active transaction), the Mule may choose to execute synchronously, despite the configuration of the stream. All this happens in memory, which means that if the server crashes, you may lose the message.

VM is a transport, which means that each thread will receive a copy of the same event, but different messages. All outgoing properties of the sender will become incoming properties of the recipient. Synchronization does not depend on the configuration of the stream, but on the selected exchange template. In addition, you can configure the virtual machine to use persistent queues and transactions, which would guarantee the loss of a null message when used correctly.

0
source

Source: https://habr.com/ru/post/1480472/


All Articles