You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/07/24 23:23:07 UTC

[GitHub] [pulsar] vzhikserg commented on a change in pull request #4797: Add support of pulsar-kafka-adapter for kafka-0.8 api

vzhikserg commented on a change in pull request #4797: Add support of pulsar-kafka-adapter for kafka-0.8 api
URL: https://github.com/apache/pulsar/pull/4797#discussion_r307057660
 
 

 ##########
 File path: pulsar-client-kafka-compat/pulsar-client-kafka_0_8/src/main/java/org/apache/kafka/clients/simple/consumer/PulsarTopicMetadataResponse.java
 ##########
 @@ -0,0 +1,71 @@
+/**
+ * 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.kafka.clients.simple.consumer;
+
+import java.util.List;
+import org.apache.pulsar.client.admin.PulsarAdmin;
+import org.apache.pulsar.client.admin.PulsarAdminException;
+import org.apache.pulsar.common.naming.TopicName;
+
+import com.google.common.collect.Lists;
+
+import kafka.javaapi.TopicMetadata;
+import kafka.javaapi.TopicMetadataResponse;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class PulsarTopicMetadataResponse extends TopicMetadataResponse {
+
+    private final List<String> topics;
+    private final String hostUrl;
+    private final int port;
+    private final PulsarAdmin admin;
+
+    public PulsarTopicMetadataResponse(PulsarAdmin admin, String hostUrl, int port, List<String> topics) {
+        super(null);
+        this.hostUrl = hostUrl;
+        this.port = port;
+        this.topics = topics;
+        this.admin = admin;
+    }
+
+    @Override
+    public List<TopicMetadata> topicsMetadata() {
+        List<TopicMetadata> metadataList = Lists.newArrayList();
+        topics.stream().forEach(topic -> {
+            int partitions;
 
 Review comment:
   Can be moved into the try block closer to the asignement

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services