Skip to content
Advertisement

How to call long running blocking void returning method with Mutiny reactive programming?

I have a chain of Async and Sync method invocation on Mutiny’s Uni, some methods are a long-running process with return type void.

What is the proper way of invoking/calling them without blocking downstream?

Below is the simple analogy code.

JavaScript

Advertisement

Answer

In general, use runSubscriptionOn and pass a specific executor:

JavaScript

Note that it will constraint the concurrency to the number of threads available in the executor.

Reference:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement