Interceptor for specified type only?

26 views
Skip to first unread message

Lukáš Vasek

unread,
Jan 17, 2017, 10:42:03 AM1/17/17
to Axon Framework Users
Hello,
is it possible to register interceptor for specified types only?

class SystemObjectTypeInterceptor<T extends CommandMessage<CreateObjectTypeCommand>> implements MessageDispatchInterceptor<T> {


@Override
public BiFunction<Integer, T, T> handle(List<T> messages) {
return (index, message) -> {
...
};
}
}


I mean if I create interceptor like above I'd like to intercept only messages of type CreateObjectTypeCommand not for all messages. Currently all messages types pass-through this interceptor. I know that I can check the type of incoming message with my message type but shouldn't this be handled by framework? Or am I creating interceptors incorrectly?

Thanks

Lukas

Allard Buijze

unread,
Jan 22, 2017, 2:42:28 PM1/22/17
to Axon Framework Users
Hi Lukas,

Interceptors capture all messages that pass through the component it was registered to.
We've been thinking of allowing annotation based interceptors, which would only invoke methods if the message matches the required parameters. 

Until then, simply return the messages that you didn't plan to intercept directly.

Cheers,

Allard

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages