Product/components used and version/fix level:
Microservice SDK 1018.510.0
Detailed explanation of the problem:
We’re using the SDK and observed a strange behavior. We use EventListeners to react on MicroserviceSubscriptionAddedEvents:
@EventListener
public void onMicroserviceSubscriptionAddedEvent(final MicroserviceSubscriptionAddedEvent event) {
logger.info("MicroserviceSubscriptionAddedEvent: {}", event);
}
This worked very good until we added a @PostConstruct block which runs some logic on the bootstrap tenant:
@PostConstruct
void init() {
String bootstrapTenant = platformProperties.getMicroserviceBoostrapUser().getTenant();
logger.info("bootstrapTenant: {}", bootstrapTenant);
subscription.runForTenant(bootstrapTenant, () -> {
logger.info("running in bootstrapTenant: {}", bootstrapTenant);
});
}
Independently of what is executed within the runForTenant block (even if it is empty): as a result, the MicroserviceSubscriptionAddedEvent is not received anymore and therefore the onMicroserviceSubscriptionAddedEvent method is not invoked!
As a side note: the MicroserviceSubscriptionsInitializedEvent is still received.
Now we wonder why that runForTenant block with the bootstrapTenant is a problem? Can someone explain?
Thanks a lot,
Michael