From commits-return-20837-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Tue Jan 22 21:39:41 2019 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 7F8C7180771 for ; Tue, 22 Jan 2019 21:39:41 +0100 (CET) Received: (qmail 16868 invoked by uid 500); 22 Jan 2019 20:39:40 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 16859 invoked by uid 99); 22 Jan 2019 20:39:40 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jan 2019 20:39:40 +0000 From: GitBox To: commits@pulsar.apache.org Subject: [GitHub] srkukarni commented on a change in pull request #3397: Exposing more methods in Sink/Source Context Message-ID: <154818958015.20007.2776980293191339625.gitbox@gitbox.apache.org> Date: Tue, 22 Jan 2019 20:39:40 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit srkukarni commented on a change in pull request #3397: Exposing more methods in Sink/Source Context URL: https://github.com/apache/pulsar/pull/3397#discussion_r249951284 ########## File path: pulsar-io/core/src/main/java/org/apache/pulsar/io/core/SinkContext.java ########## @@ -40,4 +45,66 @@ * @param value The value of the metric */ void recordMetric(String metricName, double value); + + /** + * Get a list of all input topics + * @return a list of all input topics + */ + Collection getInputTopics(); + + /** + * The tenant this sink belongs to + * @return the tenant this sink belongs to + */ + String getTenant(); + + /** + * The namespace this sink belongs to + * @return the namespace this sink belongs to + */ + String getNamespace(); + + /** + * The name of the sink that we are executing + * @return The Sink name + */ + String getSinkName(); + + /** + * The logger object that can be used to log in a sink + * @return the logger object + */ + Logger getLogger(); + + /** + * Increment the builtin distributed counter refered by key + * @param key The name of the key + * @param amount The amount to be incremented + */ + void incrCounter(String key, long amount); Review comment: It could well be useful in the future. However I always tend to add things only when needed. Thus unless there is a compelling usecase right now for sources/sinks to use this, my vote would be to defer it to later. ---------------------------------------------------------------- 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 With regards, Apache Git Services