From issues-return-189703-archive-asf-public=cust-asf.ponee.io@flink.apache.org Thu Sep 20 18:23:06 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E5BA3180671 for ; Thu, 20 Sep 2018 18:23:05 +0200 (CEST) Received: (qmail 12798 invoked by uid 500); 20 Sep 2018 16:23:05 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 12789 invoked by uid 99); 20 Sep 2018 16:23:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2018 16:23:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8EC2C18645B for ; Thu, 20 Sep 2018 16:23:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id EiHVFu5km3ap for ; Thu, 20 Sep 2018 16:23:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 63C685F56B for ; Thu, 20 Sep 2018 16:23:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1E169E2618 for ; Thu, 20 Sep 2018 16:23:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id A024E23FA2 for ; Thu, 20 Sep 2018 16:23:00 +0000 (UTC) Date: Thu, 20 Sep 2018 16:23:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-9168) Pulsar Sink Connector MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-9168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622286#comment-16622286 ] ASF GitHub Bot commented on FLINK-9168: --------------------------------------- chrismiller commented on a change in pull request #5845: [FLINK-9168][flink-connectors]Pulsar Sink connector URL: https://github.com/apache/flink/pull/5845#discussion_r219230230 ########## File path: flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarProducer.java ########## @@ -0,0 +1,304 @@ +/* + * 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.flink.streaming.connectors.pulsar; + +import org.apache.flink.api.common.functions.RuntimeContext; +import org.apache.flink.api.common.serialization.SerializationSchema; +import org.apache.flink.api.java.ClosureCleaner; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.runtime.state.FunctionInitializationContext; +import org.apache.flink.runtime.state.FunctionSnapshotContext; +import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction; +import org.apache.flink.streaming.api.functions.sink.RichSinkFunction; +import org.apache.flink.streaming.api.operators.StreamingRuntimeContext; +import org.apache.flink.streaming.connectors.pulsar.partitioner.PulsarKeyExtractor; +import org.apache.flink.util.SerializableObject; + +import org.apache.pulsar.client.api.Message; +import org.apache.pulsar.client.api.MessageBuilder; +import org.apache.pulsar.client.api.MessageId; +import org.apache.pulsar.client.api.Producer; +import org.apache.pulsar.client.api.ProducerConfiguration; +import org.apache.pulsar.client.api.PulsarClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.function.Function; + +import static org.apache.flink.util.Preconditions.checkNotNull; + +/** + * Flink Sink to produce data into a Pulsar topic. + */ +public class FlinkPulsarProducer + extends RichSinkFunction + implements CheckpointedFunction { + + private static final Logger LOG = LoggerFactory.getLogger(FlinkPulsarProducer.class); + + /** + * The pulsar service url. + */ + protected final String serviceUrl; + + /** + * User defined configuration for the producer. + */ + protected final ProducerConfiguration producerConfig; + + /** + * The name of the default topic this producer is writing data to. + */ + protected final String defaultTopicName; + + /** + * (Serializable) SerializationSchema for turning objects used with Flink into. + * byte[] for Pulsar. + */ + protected final SerializationSchema schema; + + /** + * User-provided key extractor for assigning a key to a pulsar message. + */ + protected final PulsarKeyExtractor flinkPulsarKeyExtractor; + + /** + * Produce Mode. + */ + protected PulsarProduceMode produceMode = PulsarProduceMode.AT_LEAST_ONE; + + /** + * If true, the producer will wait until all outstanding records have been send to the broker. + */ + protected boolean flushOnCheckpoint; + + // -------------------------------- Runtime fields ------------------------------------------ + + /** KafkaProducer instance. */ + protected transient Producer producer; + + /** The callback than handles error propagation or logging callbacks. */ + protected transient Function successCallback = msgId -> { Review comment: This won't deserialise correctly, it will end up null. The solution is to initialise successCallback in the open() method instead, similar to how failureCallback is initialised. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Pulsar Sink Connector > --------------------- > > Key: FLINK-9168 > URL: https://issues.apache.org/jira/browse/FLINK-9168 > Project: Flink > Issue Type: New Feature > Components: Streaming Connectors > Affects Versions: 1.6.0 > Reporter: Zongyang Xiao > Priority: Minor > Labels: pull-request-available > Fix For: 1.7.0 > > > Flink does not provide a sink connector for Pulsar. -- This message was sent by Atlassian JIRA (v7.6.3#76005)