Using plain exec() to post Pulsar message

Hi,
I’m trying to write a load simulation that tests a system that consumes Pulsar messages and exposes some REST APIs. On the Pulsar side, I only need to send the events, without further checks.

Is simply wrapping calls to PulsarClient inside exec {} calls considered a bad practice, or can it work for this simplified use-case? I did a couple of local tests (both the simulation and the service running on the dev machine) and it seems to work, but I’m worried it might not scale when aiming for “real” load levels.

Thanks a lot,
Mihai

Is simply wrapping calls to PulsarClient inside exec {} calls considered a bad practice

If your PulsarClient calls block the calling threads, yes, you are going to hurt the engine. If that’s the case, you use perform them in a distinct thread pool so you never block our threads.

If I’m performing these requests on a separate thread pool, what are the mechanisms for signalling an error?

I also have an Action/ActionBuilder-based implementation, that doesn’t use thread pools explicitly. Would a distinct thread pool needed in this case as well?