@Timeout not working on Custom Command Gateway with Simple Command Bus?

Hi,

I’ve done a little test involving a @Timeout annotated method on a Custom Command Gateway interface. This method is declared as throwing a TimeoutException.

I’ve observed that, when invoked through a SimpleCommandBus, the TimeoutException is never thrown and the processing of the CommandHandler run normally whatever the value of @Timeout is.

The same example does work with a DisruptorCommandBus: a TimeoutException is thrown to the calling thread according to the value of @Timeout.

I guess that this due to the fact that with a SimpleCommandBus the CommandHandler is executed in the context of the calling thread.So no way to manage timeout!

May be it should be mentionned in the documentation.

Hi,

your observation is correct. The timeout only works for command buses that process commands in another thread than the one sending it.

I will put a mention of this in the documentation. Thanks for pointing it out.
Cheers,

Allard