Skip to content

Commit bea4f5b

Browse files
ffbrunovigidiobrmagadutra
authored andcommitted
feat: add overload constructor to BatchProduceItem without partition parameter
1 parent badac70 commit bea4f5b

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/KafkaFlow/Producers/BatchProduceItem.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,33 @@ public class BatchProduceItem
1414
/// <param name="messageKey">The message partition key</param>
1515
/// <param name="messageValue">The message content</param>
1616
/// <param name="headers">The message headers</param>
17-
/// <param name="partition">The partition to produce the message to. If null, the partitioner will be used.</param>
1817
public BatchProduceItem(
1918
string topic,
2019
object messageKey,
2120
object messageValue,
22-
IMessageHeaders headers,
23-
int? partition = null)
21+
IMessageHeaders headers)
2422
{
2523
this.Topic = topic;
2624
this.MessageKey = messageKey;
2725
this.MessageValue = messageValue;
2826
this.Headers = headers;
27+
}
28+
29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="BatchProduceItem"/> class.
31+
/// </summary>
32+
/// <param name="topic">The destination topic</param>
33+
/// <param name="messageKey">The message partition key</param>
34+
/// <param name="messageValue">The message content</param>
35+
/// <param name="headers">The message headers</param>
36+
/// <param name="partition">The partition to produce the message to</param>
37+
public BatchProduceItem(
38+
string topic,
39+
object messageKey,
40+
object messageValue,
41+
IMessageHeaders headers,
42+
int partition) : this(topic, messageKey, messageValue, headers)
43+
{
2944
this.Partition = partition;
3045
}
3146

0 commit comments

Comments
 (0)