fx19880617 commented on a change in pull request #6408: URL: https://github.com/apache/incubator-pinot/pull/6408#discussion_r552393381
########## File path: pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java ########## @@ -233,8 +233,8 @@ public void deleteSegmentFile() { private final SegmentVersion _segmentVersion; private final SegmentBuildTimeLeaseExtender _leaseExtender; private SegmentBuildDescriptor _segmentBuildDescriptor; - private StreamConsumerFactory _streamConsumerFactory; - private StreamPartitionMsgOffsetFactory _streamPartitionMsgOffsetFactory; + private final StreamConsumerFactory _streamConsumerFactory; Review comment: do we need final for these ? ########## File path: pinot-tools/src/main/java/org/apache/pinot/tools/streams/MeetupRsvpJsonStream.java ########## @@ -0,0 +1,105 @@ +/** + * 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.pinot.tools.streams; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.net.URI; +import java.util.Properties; +import javax.websocket.ClientEndpointConfig; +import javax.websocket.Endpoint; +import javax.websocket.EndpointConfig; +import javax.websocket.MessageHandler; +import javax.websocket.Session; +import org.apache.pinot.spi.stream.StreamDataProducer; +import org.apache.pinot.spi.stream.StreamDataProvider; +import org.apache.pinot.spi.utils.JsonUtils; +import org.apache.pinot.spi.utils.StringUtils; +import org.apache.pinot.tools.utils.KafkaStarterUtils; +import org.glassfish.tyrus.client.ClientManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class MeetupRsvpJsonStream { + private static final Logger LOGGER = LoggerFactory.getLogger(MeetupRsvpJsonStream.class); + + private final StreamDataProducer _producer; + + private ClientManager _client; + private boolean _keepPublishing; + + public MeetupRsvpJsonStream() + throws Exception { + Properties properties = new Properties(); + properties.put("metadata.broker.list", KafkaStarterUtils.DEFAULT_KAFKA_BROKER); + properties.put("serializer.class", "kafka.serializer.DefaultEncoder"); + properties.put("request.required.acks", "1"); + _producer = StreamDataProvider.getStreamDataProducer(KafkaStarterUtils.KAFKA_PRODUCER_CLASS_NAME, properties); + } + + public void run() { + try { + _client = ClientManager.createClient(); + _keepPublishing = true; + + _client.connectToServer(new Endpoint() { + @Override + public void onOpen(Session session, EndpointConfig config) { + session.addMessageHandler(new MessageHandler.Whole<String>() { + @Override + public void onMessage(String message) { Review comment: can we extend MeetupRsvpStream and override a method to generate the msg to produce? ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org