merlimat closed pull request #1701: Fix Trigger functionality for non Java Functions URL: https://github.com/apache/incubator-pulsar/pull/1701
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 513443e429..49c652f88e 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 @@ -480,10 +480,6 @@ public Response triggerFunction(final @PathParam("tenant") String tenant, FunctionMetaData functionMetaData = functionMetaDataManager.getFunctionMetaData(tenant, namespace, functionName); String inputTopicToWrite; - // only if the source is PulsarSource and if the function consumes only one topic - if (!functionMetaData.getFunctionDetails().getSource().getClassName().equals(PulsarSource.class.getName())) { - return Response.status(Status.BAD_REQUEST).build(); - } if (topic != null) { inputTopicToWrite = topic; } else if (functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap().size() == 1) { @@ -492,6 +488,10 @@ public Response triggerFunction(final @PathParam("tenant") String tenant, } else { return Response.status(Status.BAD_REQUEST).build(); } + if (functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap() == null + || !functionMetaData.getFunctionDetails().getSource().getTopicsToSerDeClassNameMap().containsKey(inputTopicToWrite)) { + return Response.status(Status.BAD_REQUEST).build(); + } String outputTopic = functionMetaData.getFunctionDetails().getSink().getTopic(); Reader reader = null; Producer producer = null; ---------------------------------------------------------------- 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