Triggering a function means that you invoke a function by producing a message to one of the input topics via the CLI. You can use the trigger command to trigger a function at any time.
tip
With the pulsar-admin CLI, you can send messages to functions without using the pulsar-client tool or a language-specific client library.
To learn how to trigger a function, you can start with a Python function that returns a simple string based on the input as follows.
# myfunc.py defprocess(input): return"This function has been triggered with a value of {0}".format(input)
In the trigger command, topic info is not required. You only need to specify basic information about the function, such as tenant, namespace, and function name.
The consumer listening on the output topic produces something as follows in the log.
----- got message ----- This function has been triggered with a value of hello world