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

KNetProducer stores a wrong timestamp if not explicitly set #223

Closed
masesdevelopers opened this issue Aug 31, 2023 · 1 comment · Fixed by #224
Closed

KNetProducer stores a wrong timestamp if not explicitly set #223

masesdevelopers opened this issue Aug 31, 2023 · 1 comment · Fixed by #224
Assignees
Labels
bug Something isn't working KNet KNet related issue

Comments

@masesdevelopers
Copy link
Contributor

Describe the bug
The timestamp stored in a topic is not set to current time, but reports the UNIX epoch time.

To Reproduce
Steps to reproduce the behavior:

  1. Allocates a KNetProducer
  2. Produce a KNetProducerRecord<TKey, TValue>(topic, key, value)
  3. Get data from the topic and see the timestamp

Expected behavior
The timestamp shall be set to the current time if not explicitly set in KNetProducerRecord

Screenshots
No screenshot

Desktop (please complete the following information):
Latest KNet release

Additional context
N/A

@masesdevelopers masesdevelopers added bug Something isn't working KNet KNet related issue labels Aug 31, 2023
@masesdevelopers masesdevelopers self-assigned this Aug 31, 2023
@masesdevelopers
Copy link
Contributor Author

To inform Apache Kafka to associate a timestamp to the record, the corresponding data in ProducerRecord shall be null since the timestamp is a Java.Lang.Long which can be a nullable type.
When the conversion is done here

return new ProducerRecord<byte[], byte[]>(record.Topic, record.Partition, record.Timestamp,
the original type is not a nullable type since this is the declaration
public long Timestamp { get; private set; }

To avoid the problem both Timestamp and Partition shall be converted into .NET nullable types. A nullable Partition inform Apache Kafka to choose the partition, if the topic have multiple one, using the partition strategy in use, otherwise always the default one (0 for an int) will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working KNet KNet related issue
Projects
None yet
1 participant