You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/event-hubs/event-hubs-java-get-started-receive-eph.md
+45-5Lines changed: 45 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ manager: timlt
8
8
ms.service: event-hubs
9
9
ms.workload: core
10
10
ms.topic: article
11
-
ms.date: 08/12/2018
11
+
ms.date: 08/26/2018
12
12
ms.author: shvija
13
13
14
14
---
@@ -51,18 +51,18 @@ To use EventProcessorHost, you must have an [Azure Storage account][Azure Storag
51
51
52
52
### Create a Java project using the EventProcessor Host
53
53
54
-
The Java client library for Event Hubs is available for use in Maven projects from the [Maven Central Repository][Maven Package], and can be referenced using the following dependency declaration inside your Maven project file. The current version is 1.0.0:
54
+
The Java client library for Event Hubs is available for use in Maven projects from the [Maven Central Repository][Maven Package], and can be referenced using the following dependency declaration inside your Maven project file. The current version is for the artifact azure-eventhubs-eph is 2.0.1 and the current version for the artifact azure-eventhubs is 1.0.2:
55
55
56
56
```xml
57
57
<dependency>
58
58
<groupId>com.microsoft.azure</groupId>
59
59
<artifactId>azure-eventhubs</artifactId>
60
-
<version>1.0.0</version>
60
+
<version>1.0.2</version>
61
61
</dependency>
62
62
<dependency>
63
63
<groupId>com.microsoft.azure</groupId>
64
64
<artifactId>azure-eventhubs-eph</artifactId>
65
-
<version>1.0.0</version>
65
+
<version>2.0.1</version>
66
66
</dependency>
67
67
```
68
68
@@ -240,6 +240,46 @@ For different types of build environments, you can explicitly obtain the latest
240
240
241
241
This tutorial uses a single instance of EventProcessorHost. To increase throughput, it is recommended that you run multiple instances of EventProcessorHost, preferably on separate machines. This provides redundancy as well. In those cases, the various instances automatically coordinate with each other in order to load balance the received events. If you want multiple receivers to each process *all* the events, you must use the **ConsumerGroup** concept. When receiving events from different machines, it might be useful to specify names for EventProcessorHost instances based on the machines (orroles) in which they are deployed.
242
242
243
+
## Publishing Messages to EventHub
244
+
245
+
Before messages are retrieved by consumers, they have to be published to the partitions first by the publishers. It is worth noting that when messages are published to event hub synchronously using the sendSync() method on the com.microsoft.azure.eventhubs.EventHubClient object, the message could be sent to a specific partition or distributed to all available partitions in a round-robin manner depending on whether the partition key is specified or not.
246
+
247
+
When a string representing the partition key is specified, the key will be hashed to determine which partition to send the event to.
248
+
249
+
When the partition key is not set, then messages will round-robined to all available partitions
// Transmits the event to event hub without a partition key
259
+
// If a partition key is not set, then we will round-robin to all topic partitions
260
+
eventHubClient.sendSync(sendEvent);
261
+
262
+
// the partitionKey will be hash'ed to determine the partitionId to send the eventData to.
263
+
eventHubClient.sendSync(sendEvent, partitionKey);
264
+
265
+
```
266
+
267
+
## Implementing a CustomCheckpointManager for EventProcessorHost (EPH)
268
+
269
+
The API provides a mechanism to implement your custom checkpoint manager for scenarios where the default implementation is not compatible with your use case.
270
+
271
+
The default checkpoint manager uses blob storage but if you override the checkpoint manager used by EPH with your own implementation, you can use any store you want to back the your checkpoint manager implementation.
272
+
273
+
You have to create a class that implements the interface com.microsoft.azure.eventprocessorhost.ICheckpointManager
274
+
275
+
Use your custom implementation of the checkpoint manager (com.microsoft.azure.eventprocessorhost.ICheckpointManager)
276
+
277
+
Within your implementation, you can override the default checkpointing mechanism and implement our own checkpoints based on your own data store (SQLServer, CosmosDB, RedisCacheetc). It is recommended that the store used to back your checkpoint manager implementation be accessible to all EPH instances that are processing events for the consumer group.
278
+
279
+
You can use any datastore that will be available in your environment.
280
+
281
+
The com.microsoft.azure.eventprocessorhost.EventProcessorHost class provides you with 2 constructors that allow you to override the checkpoint manager for your EventProcessorHost.
282
+
243
283
## Next steps
244
284
245
285
You can learn more about Event Hubs by visiting the following links:
@@ -257,4 +297,4 @@ You can learn more about Event Hubs by visiting the following links:
0 commit comments