Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable accessing Message in TableView #1176

Open
petermnhull opened this issue Feb 13, 2024 · 0 comments · May be fixed by #1174
Open

Enable accessing Message in TableView #1176

petermnhull opened this issue Feb 13, 2024 · 0 comments · May be fixed by #1174

Comments

@petermnhull
Copy link
Contributor

petermnhull commented Feb 13, 2024

Is your feature request related to a problem? Please describe.
I have a use case for processing messages in a TableView where I need to be able to access the metadata (e.g. publication time) for each message, for example to check if the message for a key is "out-of-date" or recent.

Currently this is not possible as the TableView implementation only provides the message as encoded by the SchemaValueType and discards all metadata.

Describe the solution you'd like
I would like to introduce two new methods to the TableView interface for accessing the associated pulsar.Message for each key:

  1. Message(key string) Message - access the pulsar.Message for a given key (as an alternative to Get)
    2.Messages() map[string]Message - access all the stored pulsar.Message objects for each key (as an alternative to Entries)

I propose to do this by changing how the messages are processed - instead of storing the encoded payload in processMessage, instead we store a map of map[string]Message. Backwards compatibility will be maintained by always returning the payload in the existing methods.

Describe alternatives you've considered
Alternatives include:
There are no current alternatives for accessing message metadata while using TableView.

Instead of changing any of the storage implementation, we can add a new map which additionally stores a mapping from key to pulsar.Message, and only use this map for the two new methods. I initially decided against this to avoid duplicating the logic for storing messages.

Additional context
NA.

Please let me know if this requires any further design or improvement documentation, happy to provide more detail if needed.

@petermnhull petermnhull linked a pull request Feb 13, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant