Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current stateUnder Discussion

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

The TaskMetadata class in KafkaStreams is used for encoding information about a particular task, such as its offsets, topic partitions, and taskId. For some reason, the taskId is stored and exposed as a String object, rather than using the actual TaskId class. We should move towards using TaskId here, since that's literally what it is, and because if/when we add additional fields to the TaskId it will become more and more unwieldy to parse the string encoding in order to extract the actual information about the task.

Public Interfaces

Code Block
languagejava
titleTaskMetadata
class TaskMetadata {

    @Deprecated
    public String taskId() {
        return taskId.toString();
    }

    // New
    public TaskId id() {
        return taskId;
    }
}

Proposed Changes

To migrate from the String to TaskId, we'll need to deprecate the existing getter method and add a new one. It's a bit unfortunate that we now can't use the name `taskId()` for this method, but oh well. We can just call it `id()` instead.

Compatibility, Deprecation, and Migration Plan

The TaskMetadata#taskId() method will be deprecated and removed in a future release

Rejected Alternatives

N/A