Skip to content

Commit d22cac9

Browse files
anchitjdrinehimer
andauthored
Fix Backward Compatibility Issue in TopicPartitionOffset Constructor (#2066)
* Fix backwards compatability of TopicPartitionOffset constructor #2060 * Fix bug and add changelog --------- Co-authored-by: drinehim <[email protected]>
1 parent 3a0aa64 commit d22cac9

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 2.2.0
2+
3+
## Fixes
4+
5+
- Fix backwards compatability of TopicPartitionOffset constructor. ([drinehimer](https://github.com/drinehimer), #2066)
6+
7+
18
# 2.1.1
29

310
## Enhancements

src/Confluent.Kafka/TopicPartitionOffset.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ namespace Confluent.Kafka
2323
/// </summary>
2424
public class TopicPartitionOffset
2525
{
26+
/// <summary>
27+
/// Initializes a new TopicPartitionOffset instance.
28+
/// </summary>
29+
/// <param name="tp">
30+
/// Kafka topic name and partition.
31+
/// </param>
32+
/// <param name="offset">
33+
/// A Kafka offset value.
34+
/// </param>
35+
public TopicPartitionOffset(TopicPartition tp, Offset offset)
36+
: this(tp.Topic, tp.Partition, offset, null) { }
37+
2638
/// <summary>
2739
/// Initializes a new TopicPartitionOffset instance.
2840
/// </summary>
@@ -36,8 +48,24 @@ public class TopicPartitionOffset
3648
/// The offset leader epoch (optional).
3749
/// </param>
3850
public TopicPartitionOffset(TopicPartition tp, Offset offset,
39-
int? leaderEpoch = null)
40-
: this(tp.Topic, tp.Partition, offset, leaderEpoch) {}
51+
int? leaderEpoch)
52+
: this(tp.Topic, tp.Partition, offset, leaderEpoch) { }
53+
54+
/// <summary>
55+
/// Initializes a new TopicPartitionOffset instance.
56+
/// </summary>
57+
/// <param name="topic">
58+
/// A Kafka topic name.
59+
/// </param>
60+
/// <param name="partition">
61+
/// A Kafka partition.
62+
/// </param>
63+
/// <param name="offset">
64+
/// A Kafka offset value.
65+
/// </param>
66+
public TopicPartitionOffset(string topic, Partition partition,
67+
Offset offset)
68+
: this(topic, partition, offset, null) { }
4169

4270
/// <summary>
4371
/// Initializes a new TopicPartitionOffset instance.
@@ -55,7 +83,7 @@ public TopicPartitionOffset(TopicPartition tp, Offset offset,
5583
/// The optional offset leader epoch.
5684
/// </param>
5785
public TopicPartitionOffset(string topic, Partition partition,
58-
Offset offset, int? leaderEpoch = null)
86+
Offset offset, int? leaderEpoch)
5987
{
6088
Topic = topic;
6189
Partition = partition;

0 commit comments

Comments
 (0)