Skip to Content
Apr 28, 2022 at 07:27 AM

Multi Tenant / TenantProvider

226 Views Last edit Apr 28, 2022 at 07:28 AM 3 rev

Hello experts,

we have a CAP Java Multitenant Project and we need to get information about all subscribed tenants during runtime.

I tried following snippet corresponding to the capire docs ( to iterate through all tenants. We tested it both locally and on BTP/CF and although we do have active subscriptions, readTenants() always returns a List with exactly one item which is null.

Can you provide assistance?

TenantProviderService tenantProvider = runtime.getServiceCatalog().getService(TenantProviderService.class, TenantProviderService.DEFAULT_NAME);
List<String> tenants = tenantProvider.readTenants();
tenants.forEach(tenant -> {
	runtime.requestContext().privilegedUser().modifyUser(user -> user.setTenant(tenant)).run(context -> {
		..... your code