mattisonchao commented on code in PR #21379:
URL: https://github.com/apache/pulsar/pull/21379#discussion_r1362058397


##########
pulsar-websocket/src/main/java/org/apache/pulsar/websocket/MultiTopicConsumerHandler.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.websocket;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import com.google.common.base.Splitter;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.pulsar.common.naming.TopicName;
+import org.apache.pulsar.common.util.Codec;
+import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
+
+/**
+ *
+ * WebSocket end-point url handler to handle incoming receive and acknowledge 
requests.
+ * <p>
+ * <b>receive:</b> socket-proxy keeps pushing messages to client by writing 
into session. However, it dispatches N
+ * messages at any point and after that on acknowledgement from client it 
dispatches further messages. <br/>
+ * <b>acknowledge:</b> it accepts acknowledgement for a given message from 
client and send it to broker. and for next
+ * action it notifies receive to dispatch further messages to client.
+ * </P>
+ *
+ */
+public class MultiTopicConsumerHandler extends ConsumerHandler {
+
+    public MultiTopicConsumerHandler(WebSocketService service, 
HttpServletRequest request,
+                                     ServletUpgradeResponse response) {
+        super(service, request, response);
+    }
+
+    @Override
+    protected void extractTopicName(HttpServletRequest request) {
+        String uri = request.getRequestURI();
+        List<String> parts = Splitter.on("/").splitToList(uri);
+
+        // V3 Format must be like :
+        // /ws/v3/consumer/my-subscription?topicsPattern="a.*"  
//ws/v3/consumer/my-subscription?topics="a,b,c"
+        checkArgument(parts.size() >= 4, "Invalid topic name format");

Review Comment:
   Should it be `>=5` or `==5`?



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to