Azure / Azure/azure-sdk-for-cpp

Event offset not correctly assigned in ProcessorPartitionClient::UpdateCheckpoint()

Open
#6,821 1 comment 0 reactions 0 assignees View on GitHub
Client customer-reported Event Hubs needs-team-attention question Service Attention
Dominant language
C++
Stars
205
Forks
172
Avg merge
1d 3h
Merged PRs (30d)
37

Description

**Describe the bug**
When updaing the checkpoint store with an event from a given eventhub, the function UpdateCheckpoint() in class Azure::Messaging::EventHubs::ProcessorPartitionClient does not correctly extract the offset from this event, which leads to null offset in the checkpoint store as reported in this [issue](https://github.com/Azure/azure-sdk-for-cpp/issues/6497). Unfortunately this bug still exists in the main branch.

**Current implementation in file: https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/processor_partition_client.cpp (line 77-81):**
`std::string offset{};`
`if (!eventData->Offset.HasValue())`
`{`
` offset = eventData->Offset.Value();`
`}`

**Expected implementation:**
`std::string offset{};`
`if (eventData->Offset.HasValue())`
`{`
` offset = eventData->Offset.Value();`
`}`
`else {`
` throw std::runtime_error("Event does not have an offset.");`
`}`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.