Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tombstone events in Azure Event Hub for Log Compacted Topics #37463

Open
deichrenner opened this issue Sep 19, 2024 · 3 comments
Open

Tombstone events in Azure Event Hub for Log Compacted Topics #37463

deichrenner opened this issue Sep 19, 2024 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs Messaging Messaging crew needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@deichrenner
Copy link

  • Package Name: azure-eventhub
  • Package Version: 5.12.1
  • Operating System: MacOS 14.6
  • Python Version: 3.12.4

Describe the bug
We want to use log compacted Event Hubs (see https://learn.microsoft.com/en-us/azure/event-hubs/use-log-compaction) with the python SDK. To use the full potential of the log compacted topics we need to be able to send tombstone events to indicate the end-of-life for a certain event indicated by its partition_key.

We naively followed the documentation and tried to send an empty event with an existing partition_key like

from azure.eventhub import EventData

tombstone_event = EventData(None)

However, the body of an event cannot be None. Therefore, the next best guess was to use EventData(b''). But this just sends and empty string and does not trigger the tombstone mechanic of the queue.

To Reproduce
Steps to reproduce the behavior:

  1. Create a log compacted eventhub with a retention for tombstone events of 1 hour.

  2. Send a message with a null body (as mentioned in the documentation, linked above)

    Example code:

    import asyncio
    import os
    import uuid
    
    import dotenv
    from azure.eventhub import EventData
    from azure.eventhub.aio import EventHubProducerClient
    from azure.identity.aio import DefaultAzureCredential
    
    dotenv.load_dotenv()
    
    credential = DefaultAzureCredential()
    
    
    async def run():
        producer = EventHubProducerClient.from_connection_string(
            os.getenv("EVENT_HUB_CONNECTION_STRING"),
            eventhub_name=os.getenv("EVENT_HUB_NAME"),
            credential=credential,
        )
        async with producer:
            user_id = str(uuid.uuid4())
            event_data_batch = await producer.create_batch(partition_key=user_id)
            event_data_batch.add(EventData(b''))
            await producer.send_batch(event_data_batch)
    
            await credential.close()
    
    
    if __name__ == "__main__":
        asyncio.run(run())

Expected behavior
After one hour, I would have expected the topic to be empty. However, the message with the empty body still remains in the topic.

Question
How to create an Event with a null body?

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Sep 19, 2024
Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@kashifkhan
Copy link
Member

Thank you for the feedback @deichrenner . We will investigate and get back to you asap.

@kashifkhan kashifkhan added the Messaging Messaging crew label Sep 19, 2024
@kashifkhan
Copy link
Member

@deichrenner I have reached out to the service team to see exactly what is happening and where this issue resides. Will update as soon as I have something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs Messaging Messaging crew needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants