You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by sa...@apache.org on 2018/08/31 21:56:08 UTC

[incubator-pulsar] branch master updated: Fix semantics of skip output (#2468)

This is an automated email from the ASF dual-hosted git repository.

sanjeevrk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 581acc6  Fix semantics of skip output (#2468)
581acc6 is described below

commit 581acc67ec68a0b1eaeba6d959d94ca2a55f077f
Author: Sanjeev Kulkarni <sa...@gmail.com>
AuthorDate: Fri Aug 31 14:56:06 2018 -0700

    Fix semantics of skip output (#2468)
    
    * Fix semantics of skip output
    
    * Remove skip Output altogether
    
    * Remove doc about skip-output since we have removed it
    
    * Fixed unittest
    
    * Fixed test
---
 .../java/org/apache/pulsar/admin/cli/CmdFunctionsTest.java     |  6 ++----
 .../main/java/org/apache/pulsar/admin/cli/CmdFunctions.java    | 10 +---------
 .../java/org/apache/pulsar/functions/utils/FunctionConfig.java |  1 -
 site2/docs/reference-pulsar-admin.md                           |  3 ---
 4 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/CmdFunctionsTest.java b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/CmdFunctionsTest.java
index 7eb1dff..fe0a3f4 100644
--- a/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/CmdFunctionsTest.java
+++ b/pulsar-client-tools-test/src/test/java/org/apache/pulsar/admin/cli/CmdFunctionsTest.java
@@ -498,7 +498,6 @@ public class CmdFunctionsTest {
         cmd.run(new String[] {
                 "create",
                 "--inputs", inputTopicName,
-                "--skip-output",
                 "--jar", "SomeJar.jar",
                 "--tenant", "sample",
                 "--namespace", "ns1",
@@ -513,7 +512,7 @@ public class CmdFunctionsTest {
 
     
     @Test
-    public void testCreateWithoutOutputTopic() throws Exception {
+    public void testCreateWithoutOutputTopic() {
 
         ConsoleOutputCapturer consoleOutputCapturer = new ConsoleOutputCapturer();
         consoleOutputCapturer.start();
@@ -530,9 +529,8 @@ public class CmdFunctionsTest {
 
         CreateFunction creater = cmd.getCreater();
         consoleOutputCapturer.stop();
-        String output = consoleOutputCapturer.getStderr();
         assertNull(creater.getFunctionConfig().getOutput());
-        assertTrue(output.contains("output topic is not present"));
+        assertTrue(consoleOutputCapturer.getStdout().contains("Created successfully"));
     }
 
     @Test
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
index 3996349..e567814 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
@@ -238,10 +238,8 @@ public class CmdFunctions extends CmdBase {
         @Parameter(names = "--topics-pattern", description = "The topic pattern to consume from list of topics under a namespace that match the pattern. [--input] and [--topic-pattern] are mutually exclusive. Add SerDe class name for a pattern in --custom-serde-inputs (supported for java fun only)")
         protected String topicsPattern;
 
-        @Parameter(names = {"-o", "--output"}, description = "The function's output topic (use skipOutput flag to skip output topic)")
+        @Parameter(names = {"-o", "--output"}, description = "The function's output topic (If none is specified, no output is written)")
         protected String output;
-        @Parameter(names = "--skip-output", description = "Skip publishing function output to output topic")
-        protected boolean skipOutput;
         // for backwards compatibility purposes
         @Parameter(names = "--logTopic", description = "The topic to which the function's logs are produced", hidden = true)
         protected String DEPRECATED_logTopic;
@@ -390,7 +388,6 @@ public class CmdFunctions extends CmdBase {
             if (null != output) {
                 functionConfig.setOutput(output);
             }
-            functionConfig.setSkipOutput(skipOutput);
             if (null != logTopic) {
                 functionConfig.setLogTopic(logTopic);
             }
@@ -480,11 +477,6 @@ public class CmdFunctions extends CmdBase {
 
         protected void validateFunctionConfigs(FunctionConfig functionConfig) {
 
-            if (isBlank(functionConfig.getOutput()) && !functionConfig.isSkipOutput()) {
-                throw new ParameterException(
-                        "output topic is not present (pass skipOutput flag to skip publish output on topic)");
-            }
-
             if (isNotBlank(functionConfig.getJar()) && isNotBlank(functionConfig.getPy())) {
                 throw new ParameterException("Either a Java jar or a Python file needs to"
                         + " be specified for the function. Cannot specify both.");
diff --git a/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfig.java b/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfig.java
index ac96fa9..21e6112 100644
--- a/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfig.java
+++ b/pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfig.java
@@ -98,7 +98,6 @@ public class FunctionConfig {
      */
     private String outputSchemaType;
 
-    private boolean skipOutput;
     @isImplementationOfClass(implementsClass = SerDe.class)
     private String outputSerdeClassName;
     @isValidTopicName
diff --git a/site2/docs/reference-pulsar-admin.md b/site2/docs/reference-pulsar-admin.md
index 53d33b1..eddee17 100644
--- a/site2/docs/reference-pulsar-admin.md
+++ b/site2/docs/reference-pulsar-admin.md
@@ -326,7 +326,6 @@ Options
 |`--processing-guarantees`|The processing guarantees applied to the function. Can be one of: ATLEAST_ONCE, ATMOST_ONCE, or EFFECTIVELY_ONCE|ATLEAST_ONCE|
 |`--py`|The path of the Python file containing the function’s processing logic (if the function is written in Python)||
 |`--schema-type`|Schema Type to be used for storing output messages||
-|`--skip-output`|Do we supress writing to the output topic||
 |`--sliding-interval-count`|Number of messages after which the window ends||
 |`--sliding-interval-duration-ms`|The time duration after which the window slides||
 |`--state-storage-service-url`|The service URL for the function’s state storage (if the function uses a storage system different from the Apache BookKeeper cluster used by Pulsar)||
@@ -368,7 +367,6 @@ Options
 |`--processing-guarantees`|The processing guarantees applied to the function. Can be one of: ATLEAST_ONCE, ATMOST_ONCE, or EFFECTIVELY_ONCE|ATLEAST_ONCE|
 |`--py`|The path of the Python file containing the function’s processing logic (if the function is written in Python)||
 |`--schema-type`|Schema Type to be used for storing output messages||
-|`--skip-output`|Do we supress writing to the output topic||
 |`--sliding-interval-count`|Number of messages after which the window ends||
 |`--sliding-interval-duration-ms`|The time duration after which the window slides||
 |`--subscription-type`|The subscription type used by the function when consuming messages on the input topic(s). Can be either SHARED or EXCLUSIVE|SHARED|
@@ -426,7 +424,6 @@ Options
 |`--processing-guarantees`|The processing guarantees applied to the function. Can be one of: ATLEAST_ONCE, ATMOST_ONCE, or EFFECTIVELY_ONCE|ATLEAST_ONCE|
 |`--py`|The path of the Python file containing the function’s processing logic (if the function is written in Python)||
 |`--schema-type`|Schema Type to be used for storing output messages||
-|`--skip-output`|Do we supress writing to the output topic||
 |`--sliding-interval-count`|Number of messages after which the window ends||
 |`--sliding-interval-duration-ms`|The time duration after which the window slides||
 |`--subscription-type`|The subscription type used by the function when consuming messages on the input topic(s). Can be either SHARED or EXCLUSIVE|SHARED|