Azure / Azure/azure-sdk-for-cpp
Event offset not correctly assigned in ProcessorPartitionClient::UpdateCheckpoint()
- 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
Assessment
This issue has not been assessed yet.