pulsar
pulsar copied to clipboard
[Bug] python function ignores `--forward-source-message-property true`
Search before asking
- [X] I searched in the issues and found nothing similar.
Version
Pulsar version: 2.10.1
Minimal reproduce step
Follow Pulsar functions quickstart. I'm using Docker to run Pulsar standalone:
1. Run pulsar standalone
First, create a new Python file:
$ touch reverse.py
In that file, add the following:
def process(input):
return input[::-1]
$ docker run --name pulsar \
--rm -it \
-p 6650:6650 \
-p 8080:8080 \
--volume `pwd`/reverse.py:/pulsar/reverse.py \
apachepulsar/pulsar:2.10.1 bin/pulsar standalone
2. Consume results
$ docker exec -it pulsar bash -c "bin/pulsar-client consume \
persistent://public/default/forwards \
--subscription-name test \
--num-messages 0"
3. Start the function with --forward-source-message-property true (should be default)
$ docker exec -it pulsar bash -c "/pulsar/bin/pulsar-admin functions localrun \
--py '/pulsar/reverse.py' \
--classname reverse \
--inputs persistent://public/default/backwards \
--output persistent://public/default/forwards \
--tenant public \
--namespace default \
--forward-source-message-property true \
--name reverse"
4. Produce some messages with properties
$ docker exec -it pulsar bash -c "/pulsar/bin/pulsar-client produce \
persistent://public/default/backwards \
--messages '1 tset,2 tset,3 tset' \
--properties 'foo=bar'"
What did you expect to see?
The consumer in step (2) should output the properties produced.
What did you see instead?
Instead only the keys __pfn_input_msg_id__ and __pfn_input_topic__ are found in the consumed messages.
----- got message -----
key:[null], properties:[__pfn_input_msg_id__=CAwQACAA, __pfn_input_topic__=persistent://public/default/backwards], content:test 1
----- got message -----
key:[null], properties:[__pfn_input_msg_id__=CAwQASAA, __pfn_input_topic__=persistent://public/default/backwards], content:test 2
----- got message -----
key:[null], properties:[__pfn_input_msg_id__=CAwQAiAA, __pfn_input_topic__=persistent://public/default/backwards], content:test 3
Anything else?
No response
Are you willing to submit a PR?
- [X] I'm willing to submit a PR!