on 2022 Apr 28 8:27 AM
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 (https://cap.cloud.sap/docs/java/multitenancy#accessing-arbitrary-tenants) 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
});
});
Request clarification before answering.
Hi Jan, we faced the same issue.
You have to bind a instance of SaaS Provisioning Service to your application. In your application you can then call the endpoint <URL>/saas-manager/v1/application/subscriptions to get all tenants subscribed to your application.
There is also a SDK which can be used.
Regards
Johannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.