Skip to content

Commit

Permalink
Fix Backward Compatibility Issue in TopicPartitionOffset Constructor (#…
Browse files Browse the repository at this point in the history
…2066)

* Fix backwards compatability of TopicPartitionOffset constructor #2060

* Fix bug and add changelog

---------

Co-authored-by: drinehim <[email protected]>
  • Loading branch information
anchitj and drinehimer authored Jul 3, 2023
1 parent 3a0aa64 commit d22cac9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2.2.0

## Fixes

- Fix backwards compatability of TopicPartitionOffset constructor. ([drinehimer](https://github.com/drinehimer), #2066)


# 2.1.1

## Enhancements
Expand Down
34 changes: 31 additions & 3 deletions src/Confluent.Kafka/TopicPartitionOffset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ namespace Confluent.Kafka
/// </summary>
public class TopicPartitionOffset
{
/// <summary>
/// Initializes a new TopicPartitionOffset instance.
/// </summary>
/// <param name="tp">
/// Kafka topic name and partition.
/// </param>
/// <param name="offset">
/// A Kafka offset value.
/// </param>
public TopicPartitionOffset(TopicPartition tp, Offset offset)
: this(tp.Topic, tp.Partition, offset, null) { }

/// <summary>
/// Initializes a new TopicPartitionOffset instance.
/// </summary>
Expand All @@ -36,8 +48,24 @@ public class TopicPartitionOffset
/// The offset leader epoch (optional).
/// </param>
public TopicPartitionOffset(TopicPartition tp, Offset offset,
int? leaderEpoch = null)
: this(tp.Topic, tp.Partition, offset, leaderEpoch) {}
int? leaderEpoch)
: this(tp.Topic, tp.Partition, offset, leaderEpoch) { }

/// <summary>
/// Initializes a new TopicPartitionOffset instance.
/// </summary>
/// <param name="topic">
/// A Kafka topic name.
/// </param>
/// <param name="partition">
/// A Kafka partition.
/// </param>
/// <param name="offset">
/// A Kafka offset value.
/// </param>
public TopicPartitionOffset(string topic, Partition partition,
Offset offset)
: this(topic, partition, offset, null) { }

/// <summary>
/// Initializes a new TopicPartitionOffset instance.
Expand All @@ -55,7 +83,7 @@ public TopicPartitionOffset(TopicPartition tp, Offset offset,
/// The optional offset leader epoch.
/// </param>
public TopicPartitionOffset(string topic, Partition partition,
Offset offset, int? leaderEpoch = null)
Offset offset, int? leaderEpoch)
{
Topic = topic;
Partition = partition;
Expand Down

0 comments on commit d22cac9

Please sign in to comment.