Skip to content

Commit

Permalink
Merge pull request #808 from Thisara-Welmilla/improve-redeploy-publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla authored Feb 20, 2024
2 parents 4ab54bd + 1bbe4c9 commit 9a5af21
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,24 @@ private void deployEventPublisherConfiguration(InputStream publisherConfig)
return;
}

if (TenantResourceManagerDataHolder.getInstance().getCarbonEventPublisherService()
.getActiveEventPublisherConfiguration(eventPublisherConfiguration.getEventPublisherName()) != null) {
EventPublisherConfiguration oldEventPublisherConfiguration = TenantResourceManagerDataHolder.getInstance()
.getCarbonEventPublisherService().getActiveEventPublisherConfiguration(
eventPublisherConfiguration.getEventPublisherName());

if (oldEventPublisherConfiguration != null) {
destroyEventPublisherConfiguration(eventPublisherConfiguration.getEventPublisherName());
}
carbonEventPublisherService.addEventPublisherConfiguration(eventPublisherConfiguration);

try {
carbonEventPublisherService.addEventPublisherConfiguration(eventPublisherConfiguration);
} catch (EventPublisherConfigurationException e) {
if (oldEventPublisherConfiguration != null) {
carbonEventPublisherService.addEventPublisherConfiguration(oldEventPublisherConfiguration);
log.warn("The redeploying event publisher configuration fails. " +
"Hence redeploying old configuration.");
}
throw e;
}
}

/**
Expand Down

0 comments on commit 9a5af21

Please sign in to comment.