I followed the manual here: pulsar functions
I have this function declaration in Java:
package org.example.test;
import java.util.function.Function;
public class ExclamationFunction implements Function<String, String> {
@Override
public String apply(String input) {
return String.format("%s!", input);
}
}
I built the jar. Copied it to my pulsar stanalone docker and ran the following commands:
./bin/pulsar-admin functions create --classname org.example.test.ExclamationFunction --jar java-function-1.0-SNAPSHOT.jar --inputs my-topic-1 --namespace default --name JavaFunction
And then:
./bin/pulsar-admin functions trigger --tenant public --namespace default --name JavaFunction --triggerValue "test"
Now i use some client in C# to consume the queue and when i read the message i see "test" instead of "test!".
So seems the function trigger worked but the function itselft doesnt take effect.
You need to specify an output topic and consume the output topic: --output exclamation-topic