How to integrate Mutiny with my framework?

Learn about the default executors used by Mutiny and how to configure them.

Sometimes, Mutiny needs to execute tasks on other threads, such as monitoring time or delaying actions. Most operators relying on such capacity let you pass either a ScheduledExecutorService or an ExecutorService.

By default, Mutiny uses the a cached thread pool as default executor, that creates new threads as needed, but reuse previously constructed threads when they are available. A ScheduledExecutorService is also created but delegates the execution of the delayed/scheduled tasks to the default executor.

In the case you want to integrate Mutiny with a thread pool managed by a platform, you can configure it using Infrastructure.setDefaultExecutor() method:

Uni<Integer> uni1 = Uni.createFrom().item(1)

Uni<Integer> uni2 = Uni.createFrom().item(2)

You can configure the default executor using the Infrastructure.setDefaultExecutor method:

If you are using Quarkus, the default executor is already configured to use the Quarkus worker thread pool.