diff --git a/.gitignore b/.gitignore
index 0b70b496..575d83b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -344,4 +344,44 @@ __pycache__/
*.btp.cs
*.btm.cs
*.odx.cs
-*.xsd.cs
\ No newline at end of file
+*.xsd.cs
+
+# Maven
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+
+# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
+!/.mvn/wrapper/maven-wrapper.jar
+
+#Java
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+*.zip
+*.tar.gz
+*.rar
+*.iml
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
diff --git a/samples/Java/Basic/EventProcessorSample/README.md b/samples/Java/Basic/EventProcessorSample/README.md
new file mode 100644
index 00000000..972731fa
--- /dev/null
+++ b/samples/Java/Basic/EventProcessorSample/README.md
@@ -0,0 +1,36 @@
+# Receive events from Azure Event Hubs using Java
+
+**Note**: This sample is available as a tutorial [here](https://docs.microsoft.com/azure/event-hubs/event-hubs-java-get-started-receive-eph).
+
+The tutorial walks you through the consuming/receiving events from event hub. The sample uses Event Processor Host for consuming the events. Events in an event hub are distributed in various partitions to achieve parallelism while consuming. EPH simplifies processing events from event hub by managing persistent checkpoints and parallel receives.
+
+To run the sample, you need to edit the [sample code](src/main/java/com/microsoft/azure/eventhubs/samples/eventprocessorsample/EventProcessorSample.java) and provide the following information:
+
+```java
+final String namespaceName = "----ServiceBusNamespaceName-----";
+final String eventHubName = "----EventHubName-----";
+
+final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
+final String sasKey = "---SharedAccessSignatureKey----";
+
+final String storageAccountName = "---StorageAccountName----"
+final String storageAccountKey = "---StorageAccountKey----";
+```
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/eventprocessorsample-1.0.0-jar-with-dependencies.jar
+```
diff --git a/samples/Java/Basic/EventProcessorSample/pom.xml b/samples/Java/Basic/EventProcessorSample/pom.xml
new file mode 100644
index 00000000..840f98fc
--- /dev/null
+++ b/samples/Java/Basic/EventProcessorSample/pom.xml
@@ -0,0 +1,58 @@
+
+ 4.0.0
+ eventprocessorsample
+ 1.0.0
+ eventprocessorsample
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.samples.eventprocessorsample.EventProcessorSample
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+ com.microsoft.azure
+ azure-eventhubs-eph
+ 0.15.0
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/EventProcessorSample.java b/samples/Java/Basic/EventProcessorSample/src/main/java/com/microsoft/azure/eventhubs/samples/eventprocessorsample/EventProcessorSample.java
similarity index 99%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/EventProcessorSample.java
rename to samples/Java/Basic/EventProcessorSample/src/main/java/com/microsoft/azure/eventhubs/samples/eventprocessorsample/EventProcessorSample.java
index 89dd255c..33d5592f 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/EventProcessorSample.java
+++ b/samples/Java/Basic/EventProcessorSample/src/main/java/com/microsoft/azure/eventhubs/samples/eventprocessorsample/EventProcessorSample.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Basic;
+package com.microsoft.azure.eventhubs.samples.eventprocessorsample;
/*
* Until the official release, there is no package distributed for EventProcessorHost, and hence no good
diff --git a/samples/Java/Basic/ReceiveByDateTime/README.md b/samples/Java/Basic/ReceiveByDateTime/README.md
new file mode 100644
index 00000000..4ecb5b52
--- /dev/null
+++ b/samples/Java/Basic/ReceiveByDateTime/README.md
@@ -0,0 +1,30 @@
+# Receive events from Azure Event Hubs using Java
+
+This sample shows how to receive events from a particular Event Hub partition based on a date-time offset. This is a lower-level API gesture that most applications will not use, but rather lean on the Event Processor Host to manage partition ownership and check-pointing. The [Event Processor Sample](../EventProcessorSample) shows this higher level functionality.
+
+To run the sample, you need to edit the [sample code](src/main/java/com/microsoft/azure/eventhubs/samples/receivebydatetime/ReceiveByDateTime.java) and provide the following information:
+
+```java
+ final String namespaceName = "----ServiceBusNamespaceName-----";
+ final String eventHubName = "----EventHubName-----";
+ final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
+ final String sasKey = "---SharedAccessSignatureKey----";
+```
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/receivebydatetime-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/Basic/ReceiveByDateTime/pom.xml b/samples/Java/Basic/ReceiveByDateTime/pom.xml
new file mode 100644
index 00000000..bfc95eb5
--- /dev/null
+++ b/samples/Java/Basic/ReceiveByDateTime/pom.xml
@@ -0,0 +1,53 @@
+
+ 4.0.0
+ receivebydatetime
+ 1.0.0
+ receiveusingoffset
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.samples.receivebydatetime.ReceiveByDateTime
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/ReceiveByDateTime.java b/samples/Java/Basic/ReceiveByDateTime/src/main/java/com/microsoft/azure/eventhubs/samples/receivebydatetime/ReceiveByDateTime.java
similarity index 98%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/ReceiveByDateTime.java
rename to samples/Java/Basic/ReceiveByDateTime/src/main/java/com/microsoft/azure/eventhubs/samples/receivebydatetime/ReceiveByDateTime.java
index 33fa6edb..c2d0fc0c 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/ReceiveByDateTime.java
+++ b/samples/Java/Basic/ReceiveByDateTime/src/main/java/com/microsoft/azure/eventhubs/samples/receivebydatetime/ReceiveByDateTime.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Basic;
+package com.microsoft.azure.eventhubs.samples.receivebydatetime;
import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
import com.microsoft.azure.eventhubs.EventData;
diff --git a/samples/Java/Basic/ReceiveUsingOffset/README.md b/samples/Java/Basic/ReceiveUsingOffset/README.md
new file mode 100644
index 00000000..76c3e97f
--- /dev/null
+++ b/samples/Java/Basic/ReceiveUsingOffset/README.md
@@ -0,0 +1,30 @@
+# Receive events from Azure Event Hubs using Java
+
+This sample shows how to receive events from a particular Event Hub partition based on a n absolute offset. This is a lower-level API gesture that most applications will not use, but rather lean on the Event Processor Host to manage partition ownership and check-pointing. The [Event Processor Sample](../EventProcessorSample) shows this higher level functionality.
+
+To run the sample, you need to edit the [sample code](src/main/java/com/microsoft/azure/eventhubs/samples/receiveusingoffset/ReceiveUsingOffset.java) and provide the following information:
+
+```java
+ final String namespaceName = "----ServiceBusNamespaceName-----";
+ final String eventHubName = "----EventHubName-----";
+ final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
+ final String sasKey = "---SharedAccessSignatureKey----";
+```
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/receiveusingoffset-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/Basic/ReceiveUsingOffset/pom.xml b/samples/Java/Basic/ReceiveUsingOffset/pom.xml
new file mode 100644
index 00000000..dc564de4
--- /dev/null
+++ b/samples/Java/Basic/ReceiveUsingOffset/pom.xml
@@ -0,0 +1,58 @@
+
+ 4.0.0
+ receiveusingoffset
+ 1.0.0
+ receiveusingoffset
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.samples.receiveusingoffset.ReceiveUsingOffset
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+ com.microsoft.azure
+ azure-eventhubs-eph
+ 0.15.0
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/ReceiveUsingOffset.java b/samples/Java/Basic/ReceiveUsingOffset/src/main/java/com/microsoft/azure/eventhubs/samples/receiveusingoffset/ReceiveUsingOffset.java
similarity index 98%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/ReceiveUsingOffset.java
rename to samples/Java/Basic/ReceiveUsingOffset/src/main/java/com/microsoft/azure/eventhubs/samples/receiveusingoffset/ReceiveUsingOffset.java
index 6e7a66e7..2644765f 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/ReceiveUsingOffset.java
+++ b/samples/Java/Basic/ReceiveUsingOffset/src/main/java/com/microsoft/azure/eventhubs/samples/receiveusingoffset/ReceiveUsingOffset.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Basic;
+package com.microsoft.azure.eventhubs.samples.receiveusingoffset;
import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
import com.microsoft.azure.eventhubs.EventData;
diff --git a/samples/Java/Basic/Send/README.md b/samples/Java/Basic/Send/README.md
new file mode 100644
index 00000000..8d2700ef
--- /dev/null
+++ b/samples/Java/Basic/Send/README.md
@@ -0,0 +1,30 @@
+# Send events to Azure Event Hubs using Java
+
+The [Send events to Azure Event Hubs using Java](https://docs.microsoft.com/azure/event-hubs/event-hubs-java-get-started-send) tutorial walks you through ingesting into your event hub using Java with this code.
+
+To run the sample, you need to edit the [sample code](src/main/java/com/microsoft/azure/eventhubs/samples/send/Send.java) and provide the following information:
+
+```java
+ final String namespaceName = "----ServiceBusNamespaceName-----";
+ final String eventHubName = "----EventHubName-----";
+ final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
+ final String sasKey = "---SharedAccessSignatureKey----";
+```
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/send-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/Basic/Send/pom.xml b/samples/Java/Basic/Send/pom.xml
new file mode 100644
index 00000000..554b3a9b
--- /dev/null
+++ b/samples/Java/Basic/Send/pom.xml
@@ -0,0 +1,58 @@
+
+ 4.0.0
+ send
+ 1.0.0
+ send
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.samples.send.Send
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+ com.google.code.gson
+ gson
+ [2.8.2,]
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/Send.java b/samples/Java/Basic/Send/src/main/java/com/microsoft/azure/eventhubs/samples/send/Send.java
similarity index 98%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/Send.java
rename to samples/Java/Basic/Send/src/main/java/com/microsoft/azure/eventhubs/samples/send/Send.java
index 68921752..795866a1 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/Send.java
+++ b/samples/Java/Basic/Send/src/main/java/com/microsoft/azure/eventhubs/samples/send/Send.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Basic;
+package com.microsoft.azure.eventhubs.samples.send;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
diff --git a/samples/Java/Basic/SendBatch/README.md b/samples/Java/Basic/SendBatch/README.md
new file mode 100644
index 00000000..3d7b7d62
--- /dev/null
+++ b/samples/Java/Basic/SendBatch/README.md
@@ -0,0 +1,45 @@
+# Send batch events to Azure Event Hubs using Java
+
+The [Send events to Azure Event Hubs using Java](https://docs.microsoft.com/azure/event-hubs/event-hubs-java-get-started-send) tutorial walks you through ingesting into your event hub using Java with this code.
+
+This sample differs from the basic tutorial in that it collects a set of events and sends them all at once in a single gesture:
+
+``` Java
+ final LinkedList events = new LinkedList<>();
+ for (int count = 1; count < 11; count++) {
+ final PayloadEvent payload = new PayloadEvent(count);
+ final byte[] payloadBytes = gson.toJson(payload).getBytes(Charset.defaultCharset());
+ final EventData sendEvent = new EventData(payloadBytes);
+ sendEvent.getProperties().put("from", "javaClient");
+ events.add(sendEvent);
+ }
+
+ sender.sendSync(events);
+```
+
+To run the sample, you need to edit the [sample code](src/main/java/com/microsoft/azure/eventhubs/samples/sendbatch/SendBatch.java) and provide the following information:
+
+```java
+ final String namespaceName = "----ServiceBusNamespaceName-----";
+ final String eventHubName = "----EventHubName-----";
+ final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
+ final String sasKey = "---SharedAccessSignatureKey----";
+```
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/sendbatch-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/Basic/SendBatch/pom.xml b/samples/Java/Basic/SendBatch/pom.xml
new file mode 100644
index 00000000..922d2d65
--- /dev/null
+++ b/samples/Java/Basic/SendBatch/pom.xml
@@ -0,0 +1,58 @@
+
+ 4.0.0
+ sendbatch
+ 1.0.0
+ sendbatch
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.samples.sendbatch.SendBatch
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+ com.google.code.gson
+ gson
+ [2.8.2,]
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/SendBatch.java b/samples/Java/Basic/SendBatch/src/main/java/com/microsoft/azure/eventhubs/samples/sendbatch/SendBatch.java
similarity index 97%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/SendBatch.java
rename to samples/Java/Basic/SendBatch/src/main/java/com/microsoft/azure/eventhubs/samples/sendbatch/SendBatch.java
index b3535901..aaf409a0 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/SendBatch.java
+++ b/samples/Java/Basic/SendBatch/src/main/java/com/microsoft/azure/eventhubs/samples/sendbatch/SendBatch.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Basic;
+package com.microsoft.azure.eventhubs.samples.sendbatch;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
diff --git a/samples/Java/Benchmarks/AutoScaleOnIngress/README.md b/samples/Java/Benchmarks/AutoScaleOnIngress/README.md
new file mode 100644
index 00000000..cc0d6421
--- /dev/null
+++ b/samples/Java/Benchmarks/AutoScaleOnIngress/README.md
@@ -0,0 +1,23 @@
+# Automatically scale up Event Hubs throughput units
+
+The [Automatically scale up Azure Event Hubs throughput units](https://docs.microsoft.com/azure/event-hubs/event-hubs-auto-inflate) article discusses how an event hub can automatically adapt to high event flow rates. This sample illustrates this functionality with a Java sender that will produce enough events to trigger the auto-scale function to kick in.
+
+The sample is interactive and will ask for a throughput unit threshold to hit and for an event hub connection string.
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/autoscaleoningress-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/Benchmarks/AutoScaleOnIngress/pom.xml b/samples/Java/Benchmarks/AutoScaleOnIngress/pom.xml
new file mode 100644
index 00000000..e2c32acc
--- /dev/null
+++ b/samples/Java/Benchmarks/AutoScaleOnIngress/pom.xml
@@ -0,0 +1,53 @@
+
+ 4.0.0
+ autoscaleoningress
+ 1.0.0
+ autoscaleoningress
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.autoscaleoningress.AutoScaleOnIngress
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/AutoScaleOnIngress.java b/samples/Java/Benchmarks/AutoScaleOnIngress/src/main/java/com/microsoft/azure/eventhubs/samples/autoscaleoningress/AutoScaleOnIngress.java
similarity index 96%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/AutoScaleOnIngress.java
rename to samples/Java/Benchmarks/AutoScaleOnIngress/src/main/java/com/microsoft/azure/eventhubs/samples/autoscaleoningress/AutoScaleOnIngress.java
index 6442180b..b9c5ff4b 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/AutoScaleOnIngress.java
+++ b/samples/Java/Benchmarks/AutoScaleOnIngress/src/main/java/com/microsoft/azure/eventhubs/samples/autoscaleoningress/AutoScaleOnIngress.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Benchmarks;
+package com.microsoft.azure.eventhubs.samples.autoscaleoningress;
import com.microsoft.azure.eventhubs.EventData;
import com.microsoft.azure.eventhubs.EventHubException;
@@ -34,7 +34,7 @@ public class AutoScaleOnIngress {
// number is supposed to help bring 2 down)
// *********************************************************************
System.out.println();
- System.out.print("Enter no. of Target ThroughPut's to hit the EventHub: ");
+ System.out.print("Enter no. of Target Throughput Units to hit the EventHub: ");
final int tus = Integer.parseInt(System.console().readLine());
final int EVENT_SIZE = 100; // 100 bytes <-- Change these knobs to determine target throughput
diff --git a/samples/Java/Benchmarks/AutoScaleOnIngress/src/main/java/com/microsoft/azure/eventhubs/samples/autoscaleoningress/EventHubClientPool.java b/samples/Java/Benchmarks/AutoScaleOnIngress/src/main/java/com/microsoft/azure/eventhubs/samples/autoscaleoningress/EventHubClientPool.java
new file mode 100644
index 00000000..e5fc334c
--- /dev/null
+++ b/samples/Java/Benchmarks/AutoScaleOnIngress/src/main/java/com/microsoft/azure/eventhubs/samples/autoscaleoningress/EventHubClientPool.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) Microsoft. All rights reserved.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+package com.microsoft.azure.eventhubs.samples.autoscaleoningress;
+
+import com.microsoft.azure.eventhubs.EventData;
+import com.microsoft.azure.eventhubs.EventHubClient;
+import com.microsoft.azure.eventhubs.EventHubException;
+
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Consumer;
+
+
+public final class EventHubClientPool {
+
+ private final int poolSize;
+ private final String connectionString;
+ private final Object previouslySentLock = new Object();
+ private final EventHubClient[] clients;
+
+ private int previouslySent = 0;
+
+ EventHubClientPool(final int poolSize, final String connectionString) {
+ this.poolSize = poolSize;
+ this.connectionString = connectionString;
+ this.clients = new EventHubClient[this.poolSize];
+ }
+
+ public CompletableFuture initialize() throws IOException, EventHubException {
+ final CompletableFuture[] createSenders = new CompletableFuture[this.poolSize];
+ for (int count = 0; count < poolSize; count++) {
+ final int clientsIndex = count;
+ createSenders[count] = EventHubClient.createFromConnectionString(this.connectionString).thenAccept(new Consumer() {
+ @Override
+ public void accept(EventHubClient eventHubClient) {
+ clients[clientsIndex] = eventHubClient;
+ }
+ });
+ }
+
+ return CompletableFuture.allOf(createSenders);
+ }
+
+ public CompletableFuture send(Iterable events) {
+ final int poolIndex;
+ synchronized (this.previouslySentLock) {
+ poolIndex = this.previouslySent++ % poolSize;
+ }
+
+ return clients[poolIndex].send(events);
+ }
+
+ public CompletableFuture close() {
+ final CompletableFuture[] closers = new CompletableFuture[this.poolSize];
+ for (int count = 0; count < poolSize; count++) {
+ closers[count] = this.clients[count].close();
+ }
+
+ return CompletableFuture.allOf(closers);
+ }
+}
diff --git a/samples/Java/Benchmarks/IngressBenchmark/README.md b/samples/Java/Benchmarks/IngressBenchmark/README.md
new file mode 100644
index 00000000..f67ac216
--- /dev/null
+++ b/samples/Java/Benchmarks/IngressBenchmark/README.md
@@ -0,0 +1,30 @@
+# Event Hubs throughput benchmark
+
+Please review the sample code comments.
+
+To run the sample, you need to edit the [sample code](src/main/java/com/microsoft/azure/eventhubs/samples/send/Send.java) and provide the following information:
+
+```java
+ final String namespaceName = "----ServiceBusNamespaceName-----";
+ final String eventHubName = "----EventHubName-----";
+ final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
+ final String sasKey = "---SharedAccessSignatureKey----";
+```
+
+## Prerequisites
+
+Please refer to the [overview README](../../readme.md) for prerequisites and setting up the sample environment, including creating an Event Hubs cloud namespace and an Event Hub.
+
+## Build and run
+
+The sample can be built independently with
+
+```bash
+mvn clean package
+```
+
+and then run with (or just from VS Code or another Java IDE)
+
+```bash
+java -jar ./target/ingressbenchmark-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/Benchmarks/IngressBenchmark/pom.xml b/samples/Java/Benchmarks/IngressBenchmark/pom.xml
new file mode 100644
index 00000000..28712663
--- /dev/null
+++ b/samples/Java/Benchmarks/IngressBenchmark/pom.xml
@@ -0,0 +1,53 @@
+
+ 4.0.0
+ ingressbenchmark
+ 1.0.0
+ ingressbenchmark
+ jar
+
+ UTF-8
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.1
+
+
+ 1.8
+ true
+ lines,vars,source
+
+
+
+ maven-assembly-plugin
+
+
+ package
+
+ single
+
+
+
+
+
+ jar-with-dependencies
+
+
+
+ com.microsoft.azure.eventhubs.ingressbenchmark.IngressBenchmark
+
+
+
+
+
+
+
+
+ com.microsoft.azure
+ azure-eventhubs
+ 0.15.0
+
+
+
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/EventHubClientPool.java b/samples/Java/Benchmarks/IngressBenchmark/src/main/java/com/microsoft/azure/eventhubs/samples/ingressbenchmark/EventHubClientPool.java
similarity index 97%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/EventHubClientPool.java
rename to samples/Java/Benchmarks/IngressBenchmark/src/main/java/com/microsoft/azure/eventhubs/samples/ingressbenchmark/EventHubClientPool.java
index c272d331..9bfa69c2 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/EventHubClientPool.java
+++ b/samples/Java/Benchmarks/IngressBenchmark/src/main/java/com/microsoft/azure/eventhubs/samples/ingressbenchmark/EventHubClientPool.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Benchmarks;
+package com.microsoft.azure.eventhubs.samples.ingressbenchmark;
import com.microsoft.azure.eventhubs.EventData;
import com.microsoft.azure.eventhubs.EventHubClient;
diff --git a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/IngressBenchmark.java b/samples/Java/Benchmarks/IngressBenchmark/src/main/java/com/microsoft/azure/eventhubs/samples/ingressbenchmark/IngressBenchmark.java
similarity index 97%
rename from samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/IngressBenchmark.java
rename to samples/Java/Benchmarks/IngressBenchmark/src/main/java/com/microsoft/azure/eventhubs/samples/ingressbenchmark/IngressBenchmark.java
index 8529bd14..c6bbdfc8 100644
--- a/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Benchmarks/IngressBenchmark.java
+++ b/samples/Java/Benchmarks/IngressBenchmark/src/main/java/com/microsoft/azure/eventhubs/samples/ingressbenchmark/IngressBenchmark.java
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-package com.microsoft.azure.eventhubs.samples.Benchmarks;
+package com.microsoft.azure.eventhubs.samples.ingressbenchmark;
import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
import com.microsoft.azure.eventhubs.EventData;
@@ -19,7 +19,7 @@ import java.util.concurrent.ExecutionException;
import java.util.function.BiConsumer;
/*
- * Performance BenchMark is specific to customers load pattern!!
+ * Performance Benchmark is specific to customers load pattern!!
*
* This sample is intended to highlight various variables available to tune latencies
*
diff --git a/samples/Java/README.md b/samples/Java/README.md
index 1bb29f53..b990b497 100644
--- a/samples/Java/README.md
+++ b/samples/Java/README.md
@@ -3,41 +3,38 @@
Azure Event Hubs is a highly scalable data streaming platform and event ingestion service, capable of receiving and processing millions of events per second. The samples present here enables Java developers to easily ingest and process events from your event hub.
## Prerequisites
-1. The samples here are built using Maven. If you plan to use Maven, you can [download Maven](https://maven.apache.org/download.cgi). [Install and configure Maven](https://maven.apache.org/install.html). The samples present here requires version > 3.3.9.
+
+1. The samples depend on the Java JDK 1.8 and are built using Maven. You can [download Maven](https://maven.apache.org/download.cgi). [Install and configure Maven](https://maven.apache.org/install.html). The sample require Maven version > 3.3.9.
2. You need an Azure Subscription, if you do not have one - create a [free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio) before you begin
3. [An Event Hubs namespace and an event hub where you ingest the data](https://docs.microsoft.com/azure/event-hubs/event-hubs-create)
4. [A SAS key to access the event hub](https://docs.microsoft.com/azure/event-hubs/event-hubs-create#SAS)
-## Ingest events into event hub
-The tutorial [here](https://docs.microsoft.com/azure/event-hubs/event-hubs-java-get-started-send) walks you for ingesting into your event hub using Java. Download the code from GitHub. Provide the following details in your sample [Send client](https://github.com/Azure/azure-event-hubs/blob/master/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/Send.java)
+### Sending events
-```java
- final String namespaceName = "----ServiceBusNamespaceName-----";
- final String eventHubName = "----EventHubName-----";
- final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
- final String sasKey = "---SharedAccessSignatureKey----";
-```
-
-## Process events from event hub
-The tutorial here walks you through the consuming/receiving events from event hub. You can download the sample from GitHub. The sample uses Event Processor Host for consuming the events. Events in an event hub are distributed in various partitions to achieve parallelism while consuming. EPH simplifies processing events from event hub by managing persistent checkpoints and parallel receives. Provide the following details in your sample [EventProcessorHost client](https://github.com/Azure/azure-event-hubs/blob/master/samples/Java/src/main/java/com/microsoft/azure/eventhubs/samples/Basic/EventProcessorSample.java)
-
-
-```java
-final String namespaceName = "----ServiceBusNamespaceName-----";
-final String eventHubName = "----EventHubName-----";
-
-final String sasKeyName = "-----SharedAccessSignatureKeyName-----";
-final String sasKey = "---SharedAccessSignatureKey----";
-
-final String storageAccountName = "---StorageAccountName----"
-final String storageAccountKey = "---StorageAccountKey----";
-```
-
-## Running the sample
-Do a maven clean compile from the location you have your samples in
-``` java
-cd azure-event-hubs/samples/Java/
-mvn clean compile exec:java
+* **Send** - The [Send](./Basic/Send) sample illustrates how to ingest events into your event hub.
+* **SendBatch** - The [SendBatch](./Basic/SendBatch) sample illustrates how to ingest batches of events into your event hub.
+
+### Processing events
+
+* **ReceiveByDateTime** - The [ReceiveByDateTime](./Basic/ReceiveByDateTime) sample illustrates how to receive events from an event hub partition using a specific date-time offset.
+* **ReceiveUsingOffset** - The [ReceiveUsingOffset](./Basic/ReceiveUsingOffset) sample illustrates how to receive events from an event hub partition using a specific data offset.
+* **EventProcessorSample** - The [EventProcessorSample](./Basic/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](./Benchmarks/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](./Benchmarks/IngressBenchmark) sample allows measuring the ingress rate.
+
+## Build and run
+
+All samples can be built at once with
+
+```bash
+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:
+```bash
+java -jar ./target/{project}-1.0.0-jar-with-dependencies.jar
+```
\ No newline at end of file
diff --git a/samples/Java/pom.xml b/samples/Java/pom.xml
index 398ab66f..c74944f5 100644
--- a/samples/Java/pom.xml
+++ b/samples/Java/pom.xml
@@ -1,36 +1,33 @@
-
+
- 4.0.0
- azure-eventhubs-samples
- azure-eventhubs-samples
+ 4.0.0
+ com.microsoft.azure
+ azure-eventhubs-samples
+ azure-eventhubs-samples
+ 1.0.0
+ pom
-
-
- com.microsoft.azure
- azure-eventhubs-eph
- 0.15.0
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.5
-
-
- 1.8
- true
- true
- true
-
-
-
-
-
- com.microsoft.azure
- 1.0.0
+
+ UTF-8
+
+
+ ${project.basedir}/target
+ ${project.build.directory}/classes
+ ${project.artifactId}-${project.version}
+ ${project.build.directory}/classes
+ ${project.basedir}/src/
+ ${project.basedir}/test/
+
+
+ Basic/EventProcessorSample
+ Basic/ReceiveByDateTime
+ Basic/ReceiveUsingOffset
+ Basic/Send
+ Basic/SendBatch
+ Benchmarks/AutoScaleOnIngress
+ Benchmarks/IngressBenchmark
+
diff --git a/samples/Java/receive-using-eph.md b/samples/Java/receive-using-eph.md
deleted file mode 100644
index 3e68d868..00000000
--- a/samples/Java/receive-using-eph.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Receive events from Azure Event Hubs using Java
-
-**Note**: This sample is available as a tutorial [here](https://docs.microsoft.com/azure/event-hubs/event-hubs-java-get-started-receive-eph).
\ No newline at end of file
diff --git a/samples/Java/send.md b/samples/Java/send.md
deleted file mode 100644
index c0740fc3..00000000
--- a/samples/Java/send.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Send events to Azure Event Hubs using Java
-
-**Note**: This sample is available as a tutorial [here](https://docs.microsoft.com/azure/event-hubs/event-hubs-java-get-started-send).
\ No newline at end of file