Multitenancy datasource and Hikari properties

Multitenancy extension does not consider (ignores) hikari datasource properties in the spring boot app (with datasource hikari properties configured in application.yaml).

MultiTenantDataSourceManager.addTenant uses builder and common DataSourceProperties that affect it.

I assume the problem is maxPoolSize not being applied?

Yes, any other hikari specific too like minimumIdle or maxLifetime so I had to do some quick workaround for that. It would be nice that it would be supported out of the box.

I agree this is a oversight. I guess you can fix it by creating own
MultiTenantDataSourceManager.

We can collect several issues that you find and solve it all on one patch.
Feel free to open git issue on the extension for any issue that you find.

Yes I am overriding MultiTenantDataSourceManager to do that and other things.

Generally I am overriding registerTenant method to execute original code and some extra things like run flyway and create deadline managers (I believe that you will add native support for deadline managers in multitenancy some time so I can also clean up my code).

It would be nice to not override this class and have some native hook/interceptor which would allow to execute “some code” when tenant is registered (there can be other custom components to consider multitenancy which should be also registered or some action should happen)

I think I have a suggestion for this, @KaeF, but please confirm whether this suffices.
The interceptor/hook that we’ve added to the Multitenancy Extension is the MultiTenantAwareComponent interface. Implementation of this interface will be subscribed to the TenantProvider, which will ensure that all MultiTenantAwareComponents are invoked accordingly for tenant subscriptions and deregistrations.

Would this suffice for the use case you have in mind, @KaeF?

@Steven_van_Beelen yes i think MultiTenantAwareComponent should be good enough. Thanks