Skip to content

Support non String keys in Pulsar IO: Record#getLogicalKey() and Record#getKeyBytes() #9899

@eolivelli

Description

@eolivelli

Is your enhancement request related to a problem? Please describe.
In Pulsar IO we have Record#getKey that returns an Optional, this way you cannot support non String keys.

You can write Non string keys with:

  • with KeyValue
  • With MessageBuilder#keyBytes

Describe the solution you'd like
I would like to see a Record#getKeyObject() (or other name) that returns the key as Object:

  • String if it is a string
  • byte[] if we have a base64encoded byte[]
  • Object in case of KeyValue payload (especially with SEPARATED encoding)

Describe alternatives you've considered
Using Record#getMessage#getKeyBytes() but it is not required for a Record to carry the original message

Additional context
This feature is needed in order to implement more advanced Sinks, in particular to be able to map the record key from Pulsar to Kafka and also in order to leverage Records that are using a GenericRecord as Key (see KeyValue with SEPARATED encoding)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staletype/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions