Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.34k stars 1.98k forks source link

EventHubProducerClient and EventHubProducerAsyncClient supports sending single events #41395

Open SchulteMarkus opened 2 months ago

SchulteMarkus commented 2 months ago

Affected: azure-messaging-eventhubs SDK

Is

EventHubProducerClient and EventHubProducerAsyncClient do only support sending of batches.

// From https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send?tabs=passwordless%2Croles-azure-portal
EventDataBatch eventDataBatch = producer.createBatch();
[...]
producer.send(eventDataBatch);

In our use case, we are wrapping a single event into a EventDataBatch for sending - which is unnecessary complex.

Feature request

Please provide a way to send a single event using EventHubProducerClient and/or EventHubProducerAsyncClient.

Additional context

While investigating, I have found out that azure-messaging-eventhubs once had public methods for doing so, but visibility of those methods have been changed from public to package-private, while those methods are still present in EventHubProducerClient and EventHubProducerAsyncClient

// From https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducerClient.java#L289
void send(EventData event) {
    producer.send(event).block();
}

PR: https://github.com/Azure/azure-sdk-for-java/pull/6257 Issue: https://github.com/Azure/azure-sdk-for-java/issues/6237

github-actions[bot] commented 2 months ago

@anuchandy @conniey @lmolkova

github-actions[bot] commented 2 months ago

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