apache / apache/pulsar-dotpulsar

[BUG] Cannot acknowledge messages that come in without a topicName in MessageID

Open
#287 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
271
Forks
87
PR merge metrics
No merged PRs in 30d

Description

### Description

Depending on the producer (fs-client, java, KOP etc) sometimes messages come in without a topicName inside MessageID

Image

Acknowledging this type of message breaks in
await _subConsumers[messageId.Topic].Acknowledge(messageId, cancellationToken).ConfigureAwait(false);
because messageId.Topic == ""

the consumer already has the topicName and I think the Acknowledge should create the topicName based on the other fields if the topicName is missing.

### Reproduction Steps

.

### Expected behavior

.

### Actual behavior

.

### Regression?

_No response_

### Known Workarounds
Recreating the messageID is a work-around for this issue.
```
var ackM = new MessageId(message.MessageId.LedgerId,
message.MessageId.EntryId,
message.MessageId.Partition,
message.MessageId.BatchIndex,
$"{_consumer.Topic}-partition-{message.MessageId.Partition}");
await _consumer!.Acknowledge(ackM);
```
### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the _subConsumers[messageId.Topic].Acknowledge call and inspect MessageId handling when Topic is empty. Reproduce the failure with a message lacking topicName, then verify that acknowledgement succeeds without recreating the MessageId.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.