You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This applies to projects using the Reactor extension only (I think).
If a @CommandHandler method returns a value, any @MessageHandlerInterceptor interceptor methods must also return a value, or that value is lost and null is returned to the message sender.
e.g.
@MessageHandlerInterceptor(messageType =CommandMessage::class)
funhandleTheThing(
cmdMsg:CommandMessage<*>,
chain:InterceptorChain
): Any {
return chain.proceed() // must return or value is lost
}
I discovered this via some trial and error. It might be helpful if the docs also reflected this.
The text was updated successfully, but these errors were encountered:
Thanks for this suggestion @edreyer. Returning values from command handlers is also an option when you're not using Project Reactor.
The addition Axon's Reactor Extension provides is the ReactorResultHandlerInterceptor, which I am guessing you're confusion this requirement with.
No worries though there.
At any note, I agree it would be beneficial to provide some "gotchas" when it comes to constructing interceptors. That set would thus also contain some specifics about return values from message handling functions and that the InterceptorChain's result is paramount to actually get the result back. I'd wager the Message Intercepting page would be ideal for that actually.
smcvb
changed the title
Documentation Issue: Reactor Extension: method handler interceptors must return a value
Documentation Issue: MessageHandlerInterceptor should return a value when a Message Handler has a return value
Jul 12, 2021
This applies to projects using the Reactor extension only (I think).
If a
@CommandHandler
method returns a value, any@MessageHandlerInterceptor
interceptor methods must also return a value, or that value is lost andnull
is returned to the message sender.e.g.
I discovered this via some trial and error. It might be helpful if the docs also reflected this.
The text was updated successfully, but these errors were encountered: