Azure Event Hub libraries for Java

Overview

Collect and manage millions of events per second from connected IoT devices and applications with Azure Event Hubs.

To get started with Azure Event Hubs, see Receive events from Azure Event Hubs using Java.

Client library

Send events to an Azure Event Hub and consume and process events from an Event Hub using the Event Hubs client library.

Add a dependency to your Maven pom.xml file to use the client library in your project.

Example

Send an event to an event hub.

final ConnectionStringBuilder connStr = new ConnectionStringBuilder()
                                            .setNamespaceName(namespaceName)
                                            .setEventHubName(eventHubName)
                                            .setSasKeyName(sasKeyName)
                                            .setSasKey(sasKey);
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString());

final byte[] payloadBytes = "Test AMQP message".getBytes("UTF-8");
final EventData sendEvent = new EventData(payloadBytes);

ehClient.sendSync(sendEvent);