lhotari commented on a change in pull request #10254:
URL: https://github.com/apache/pulsar/pull/10254#discussion_r648510777
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/common/events/EventsTopicNames.java
##########
@@ -18,29 +18,34 @@
*/
package org.apache.pulsar.common.events;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
/**
- * System topic name for the event type.
+ * System topic names for each {@link EventType}.
*/
public class EventsTopicNames {
+ /**
+ * All event topics are system topics, and currently, they all have this
prefix.
+ */
+ private static final String SYSTEM_TOPIC_LOCAL_NAME_PREFIX = "__";
/**
* Local topic name for the namespace events.
*/
- public static final String NAMESPACE_EVENTS_LOCAL_NAME = "__change_events";
+ public static final String NAMESPACE_EVENTS_LOCAL_NAME =
SYSTEM_TOPIC_LOCAL_NAME_PREFIX + "change_events";
/**
* Local topic name for the namespace events.
*/
- public static final String TRANSACTION_BUFFER_SNAPSHOT =
"__transaction_buffer_snapshot";
+ public static final String TRANSACTION_BUFFER_SNAPSHOT =
+ SYSTEM_TOPIC_LOCAL_NAME_PREFIX + "transaction_buffer_snapshot";
- public static boolean checkTopicIsEventsNames(String topicName) {
- if (topicName.endsWith(NAMESPACE_EVENTS_LOCAL_NAME)) {
- return true;
- } else if (topicName.endsWith(TRANSACTION_BUFFER_SNAPSHOT)) {
- return true;
- } else {
- return false;
- }
- }
+ /**
+ * The set of all events topic names.
+ */
+ public static final Set<String> EVENTS_TOPIC_NAMES =
+ new HashSet<>(Arrays.asList(NAMESPACE_EVENTS_LOCAL_NAME,
TRANSACTION_BUFFER_SNAPSHOT));
Review comment:
this should be wrapped with `Collections.unmodifiableSet` to make the
`Set` immutable.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]