apache / apache/pulsar

Publish messages with properties from a WindowFunction

Open
#19,482 1 comment 0 reactions 1 assignee Claimed by @tudormaftei View on GitHub
Stale type/enhancement
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Motivation

When using a **_WindowFunction_** to publish messages to an output topic, the original properties of the input messages are not forwarded. Forwarding properties works for functions which process individual messages but it doesn't work for functions which process a collection of messages.

### Solution

A few possible solutions:

1. Enhance **_WindowContext_** to be able to publish properties together with properties.

Messages can be published to the output topic using the publish method of the **_WindowContext_** received as a parameter in **_WindowFunction.process_** method. Additional params could be added to the **_WindowContext.publish_** method to specify the properties to be included in the output message.

2. Enhance the function configuration parameters.

Additional configuration parameters can be added in the yaml function spec which could be used as properties for all messages published from the function.

3. Add the possibility to publish messages of type **_Message_** which already incorporate properties.

### Alternatives

_No response_

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.