azure-event-hubs/samples/Java
Tom Pratt 4df1a40930 fix code comment (#485) 2024-10-18 10:49:19 -07:00
..
Basic fix code comment (#485) 2024-10-18 10:49:19 -07:00
Benchmarks Update samples for client 3.0.2 (#457) 2024-10-18 10:49:16 -07:00
Rbac Update samples for client 3.0.2 (#457) 2024-10-18 10:49:16 -07:00
.classpath Adding additional directories to samples, and updating readme's (#315) 2017-04-24 13:39:49 -07:00
.gitignore Adding additional directories to samples, and updating readme's (#315) 2017-04-24 13:39:49 -07:00
.project Adding additional directories to samples, and updating readme's (#315) 2017-04-24 13:39:49 -07:00
README.md Add pointers to new packages in readme files at the root and for .Net legacy package (#478) 2024-10-18 10:49:19 -07:00
pom.xml Sample using Event Hub Log4j Appender (#482) 2024-10-18 10:49:19 -07:00

README.md

Azure Event Hubs Java samples

Note:: The samples present here enables Java developers to easily ingest and process events from an instance of Azure Event Hubs using the legacy libraries com.microsoft.azure:azure-eventhubs and com.microsoft.azure:azure-eventhubs-eph. We strongly recommend you to use the current library com.azure:azure-messaging-eventhubs instead.

Prerequisites

  1. The samples depend on the Java JDK 1.8 and are built using Maven. You can download Maven. Install and configure Maven. The sample require Maven version > 3.3.9.
  2. You need an Azure Subscription, if you do not have one - create a free account before you begin
  3. An Event Hubs namespace and an event hub where you ingest the data
  4. A SAS key to access the event hub

Sending events

  • SendBatch - The SendBatch sample illustrates how to ingest batches of events into your event hub.
  • SimpleSend - The SimpleSend sample illustrates how to ingest events into your event hub.
  • AdvanceSendOptions - The AdvancedSendOptions sample illustrates the various options available with Event Hubs to ingest events.

Processing events

  • ReceiveByDateTime - The ReceiveByDateTime sample illustrates how to receive events from an event hub partition using a specific date-time offset.
  • ReceiveUsingOffset - The ReceiveUsingOffset sample illustrates how to receive events from an event hub partition using a specific data offset.
  • ReceiveUsingSequenceNumber - The ReceiveUsingSequenceNumber sample illustrates how can receive from an event hub partitions using a sequence number.
  • EventProcessorSample - The EventProcessorSample sample illustrates how to receive events from an event hub using the event processor host, which provides automatic partition selection and fail-over across multiple concurrent receivers.

Benchmarks

  • AutoScaleOnIngress - The AutoScaleOnIngress sample illustrates how an event hub can automatically scale up on high loads. The sample will send events at a rate that just exceed the configured rate of an event hub, causing the event hub to scale up.
  • IngressBenchmark - The IngressBenchmark sample allows measuring the ingress rate.

Build and run

All samples can be built at once with

mvn clean package

The samples are dropped into the respective sample's ./target subfolder. The build packages all dependencies into a single assembly so that you can execute them with:

java -jar ./target/{project}-1.0.0-jar-with-dependencies.jar