0

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.

omriman12
  • 1,644
  • 7
  • 25
  • 48

1 Answers1

2

You need to specify an output topic and consume the output topic: --output exclamation-topic

Marais Kruger
  • 116
  • 1
  • 7
  • woopsy, thx, interesting is that even without output topic the trigger works and my consumer did receive the message but without the functions work – omriman12 Feb 21 '21 at 06:27