Multi tenant event tracking/replay


I’ve been playing around with the different event tracking processors and some questions regarding best practices for multi tenant support for event tracking and replaying.

I’ve read through some of the existing questions in regards to this but I am still a bit confused as the best way to implement it ( Multitenant tracking event processor based on Hibernate multitenancy support & Multi tenancy event processors)

From everything I’ve read it looks like using Tracking instead of Subscribing is the way to go and I’ve implemented a basic event tracking, replaying and up casting into our current application but the tracking tokens seem to be universal with no clear way of separating them.

Would it be possible to have tracking tokens split between the different tenants so when I go to reset tokens I could specify which tenant i would like to replay, it would also help the situation to not have a tenants data replayed if they want their data scrubbed but us still needing to keep axon events as a auditing trail.

We are currently using the EventHandlerInterceptor to set a ThreadLocal tenant id that is stored in the event payload which we then use to specify which mongo collection to save data into. Could I hook something into that?


If you would use multi tenant extension this would be possible, check following example:

Thanks I’ll have a look into it, I have no idea how I’ve completely missed the multi tenant extension.

It was released recently, not blaming you :grin:

Thats good to know, I thought my googling skills were declining :smiley:

This Extension is only for Axon Framework <> Axon Server. But if you are not using Axon Server, you should disable MultiTenancyAxonServerAutoConfiguration auto-configuration and implement the same factory beans from this class with equivalents using desired technology

Thanks, yeah we are using Axon Framework and Server together so this is looking really good so far.

Should the multitenant extension work with Axon Server SE?
Some of the documentation have Axon Server EE as a requirement while some just have Axon Server 4.6+ as a requirement.

I’ve setup a test environment and while its not straight out throwing an error about not having EE I’m getting io.grpc.StatusRuntimeException: UNIMPLEMENTED: Method not found: io.axoniq.axonserver.grpc.admin.ContextAdminService/GetContexts but GetContexts doesn’t look like a specific EE method to me.

It’s only for Axon Server Enterprise (supports multiple contexts), as the Standard edition supports only a single context, therefor can’t use context per tenant approach.

You may read more in the blog. But you are right, it does not mention the Enterprise version which is a mistake.

If you are interested I can provide you a trial Enterprise license to test the multitenancy app.

That makes a lot of sense, thanks for clearing that up for me.

I would really appreciate a trial licence in order to test it out. What do you need from me?