Technoboy- commented on code in PR #18804:
URL: https://github.com/apache/pulsar/pull/18804#discussion_r1045160046
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -106,49 +107,54 @@ private CompletableFuture<Void>
sendTopicPolicyEvent(TopicName topicName, Action
new BrokerServiceException.NotAllowedException("Not
allowed to send event to health check topic"));
}
CompletableFuture<Void> result = new CompletableFuture<>();
- try {
- createSystemTopicFactoryIfNeeded();
- } catch (PulsarServerException e) {
- result.completeExceptionally(e);
- return result;
- }
-
- SystemTopicClient<PulsarEvent> systemTopicClient =
-
namespaceEventsSystemTopicFactory.createTopicPoliciesSystemTopicClient(topicName.getNamespaceObject());
-
- CompletableFuture<SystemTopicClient.Writer<PulsarEvent>> writerFuture
= systemTopicClient.newWriterAsync();
- writerFuture.whenComplete((writer, ex) -> {
- if (ex != null) {
- result.completeExceptionally(ex);
- } else {
- PulsarEvent event = getPulsarEvent(topicName, actionType,
policies);
- CompletableFuture<MessageId> actionFuture =
- ActionType.DELETE.equals(actionType) ?
writer.deleteAsync(getEventKey(event), event)
- : writer.writeAsync(getEventKey(event), event);
- actionFuture.whenComplete(((messageId, e) -> {
- if (e != null) {
- result.completeExceptionally(e);
- } else {
+ return pulsarService.getPulsarResources().getNamespaceResources()
Review Comment:
I think we can delete `result` (line 109) and simplify this logic
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]