srkukarni closed pull request #2501: Fix Trigger Functionality
URL: https://github.com/apache/incubator-pulsar/pull/2501
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java
 
b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java
index bbb4f8f44d..e9c127667d 100644
--- 
a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java
+++ 
b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java
@@ -588,7 +588,7 @@ public Response triggerFunction(final String tenant, final 
String namespace, fin
 
         FunctionMetaDataManager functionMetaDataManager = 
worker().getFunctionMetaDataManager();
         if (!functionMetaDataManager.containsFunction(tenant, namespace, 
functionName)) {
-            log.error("Function in getFunction does not exist @ /{}/{}/{}", 
tenant, namespace, functionName);
+            log.error("Function in trigger function does not exist @ 
/{}/{}/{}", tenant, namespace, functionName);
             return 
Response.status(Status.NOT_FOUND).type(MediaType.APPLICATION_JSON)
                     .entity(new ErrorData(String.format("Function %s doesn't 
exist", functionName))).build();
         }
@@ -599,15 +599,18 @@ public Response triggerFunction(final String tenant, 
final String namespace, fin
         String inputTopicToWrite;
         if (topic != null) {
             inputTopicToWrite = topic;
-        } else if 
(functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap().size()
 == 1) {
-            inputTopicToWrite = 
functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap()
+        } else if 
(functionMetaData.getFunctionDetails().getSource().getInputSpecsCount() == 1) {
+            inputTopicToWrite = 
functionMetaData.getFunctionDetails().getSource().getInputSpecsMap()
                     .keySet().iterator().next();
         } else {
+            log.error("Function in trigger function has more than 1 input 
topics @ /{}/{}/{}", tenant, namespace, functionName);
             return Response.status(Status.BAD_REQUEST).build();
         }
-        if 
(functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap()
 == null
-                || 
!functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap()
+        if 
(functionMetaData.getFunctionDetails().getSource().getInputSpecsCount() == 0
+                || 
!functionMetaData.getFunctionDetails().getSource().getInputSpecsMap()
                         .containsKey(inputTopicToWrite)) {
+            log.error("Function in trigger function has unidentified topic @ 
/{}/{}/{} {}", tenant, namespace, functionName, inputTopicToWrite);
+
             return Response.status(Status.BAD_REQUEST).build();
         }
         String outputTopic = 
functionMetaData.getFunctionDetails().getSink().getTopic();


 

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


With regards,
Apache Git Services

Reply via email to