Dear Axon Team,
I downloaded one of your demos after looking at your documentation for a POC for one of the projects I am currently working on, in order to use event sourcing and Axon/CQRS.
As far as I understand the cross cutting concerns in an Axon/CQRS Application are handled via the use of Message Dispatch Interceptors.
What I am trying to figure out is how to register multiple interceptors that are part of different microservices at a specific order.
Driven from one of your examples, image a situation where for the ‘AxonBank’ example we added one microservice lets call it ‘A’ that was responsible for checking if a user had the authority to perform the withdraw action, and is in general responsible for proving authorization of users’ actions.
Another microservice lets call it ‘B’ that was responsible for checking that the withdraw amount is not over a certain limit set by ‘AxonBank’ and in general in control of any limits set by the ‘AxonBank’ on any transactions
In that situation the configuration demanded that the user should 1st be checked if he/she can perform the action before checking if the amount is over the limit.
How would we setup the application to register interceptor from microservice ‘A’ before the interceptor from microservice ‘B’.
Thank you in advance for your help.
George Ginis
I just thought I would post a kind reminder for this question.
Any information will be greatly appreciated.
Thank you in advance.
George Ginis
Στις Σάββατο, 4 Ιουλίου 2020 στις 3:05:47 π.μ. UTC+3, ο χρήστης Giorgos Ginis έγραψε:
I am thinking that the order you register them in when building the CommandGateway is the order they are applied. That is how it is working for us.
Yes this works fine if all interceptors are registered in one module only. If you deploy separate services that each play its part in the interceptor chain then I am not sure how you guarantee the order.
That is the case I was wondering how solve
Hi Giorgos,
The registration of interceptors is as Ben Runchey puts it: the order in which the register method is called or the ordering within the list provided during building of a messaging component is leading in which interceptor goes first.
Having a microservice which is the interceptor to me only makes sense if it is a service called by an interceptor.
So they are not really the same thing, but separate from another.
Doing see means you can simply register the interceptors in the desired order to the component handling or dispatching methods.
Then, a separate microservice A can be in charge of doing the authorization, through it’s own API, invoked by the interceptor on microservice B.
Trusting this guidance will help you further Giorgos!
Cheers,
Steven
PS. It is important to note that this mailing list will be discontinued as specified in this thread.
Instead of this mailing list we have moved to use a forum style of communication, at https://discuss-next.axoniq.io/.
Hope to see you there!
Hi Steven,
Thank you very much for your input. I believe I understand what you mean.
I believe I can have ‘common service-to-service clients’ if need to be reused by any microservice, and each one can register its own interceptor(s) and use them to perform any needed checks before/after the dispatching.
Please confirm that I understood correctly.
Thank you in advance
George
Hi Giorgos,
That’s indeed the direction I was trying to explain, happy to hear I did a fair job there!
So, in short: confirmed.
Cheers,
Steven