public void updateTopic(TopicName topicName, PatchData patch, String modifiedBy) { groupService.checkGroupExists(topicName.getGroupName()); Topic retrieved = getTopicDetails(topicName); Topic modified = Patch.apply(retrieved, patch); topicValidator.ensureUpdatedTopicIsValid(modified, retrieved); if (!retrieved.equals(modified)) { Instant beforeMigrationInstant = clock.instant(); if (retrieved.getRetentionTime() != modified.getRetentionTime()) { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.updateTopic(modified) ); } topicRepository.updateTopic(modified); if (!retrieved.wasMigratedFromJsonType() && modified.wasMigratedFromJsonType()) { logger.info("Waiting until all subscriptions have consumers assigned during topic {} content type migration...", topicName.qualifiedName()); topicContentTypeMigrationService.waitUntilAllSubscriptionsHasConsumersAssigned(modified, Duration.ofSeconds(topicProperties.getSubscriptionsAssignmentsCompletedTimeoutSeconds())); logger.info("Notifying subscriptions' consumers about changes in topic {} content type...", topicName.qualifiedName()); topicContentTypeMigrationService.notifySubscriptions(modified, beforeMigrationInstant); } auditor.objectUpdated(modifiedBy, retrieved, modified); topicOwnerCache.onUpdatedTopic(retrieved, modified); } }