|
12 | 12 | import com.microsoft.azure.eventprocessorhost.ExceptionReceivedEventArgs;
|
13 | 13 | import com.microsoft.azure.eventprocessorhost.IEventProcessor;
|
14 | 14 | import com.microsoft.azure.eventprocessorhost.PartitionContext;
|
| 15 | +import com.microsoft.azure.eventprocessorhost.EventProcessorHost.EventProcessorHostBuilder; |
15 | 16 |
|
16 | 17 | import java.util.concurrent.ExecutionException;
|
17 | 18 | import java.util.function.Consumer;
|
@@ -43,16 +44,13 @@ public static void main(String args[]) throws InterruptedException, ExecutionExc
|
43 | 44 | .setSasKeyName(sasKeyName)
|
44 | 45 | .setSasKey(sasKey);
|
45 | 46 |
|
46 |
| - // Create the instance of EventProcessorHost using the most basic constructor. This constructor uses Azure Storage for |
| 47 | + // Create the instance of EventProcessorHost using the builder. This sample uses Azure Storage for |
47 | 48 | // persisting partition leases and checkpoints. The host name, which identifies the instance of EventProcessorHost, must be unique.
|
48 | 49 | // You can use a plain UUID, or use the createHostName utility method which appends a UUID to a supplied string.
|
49 |
| - EventProcessorHost host = new EventProcessorHost( |
50 |
| - EventProcessorHost.createHostName(hostNamePrefix), |
51 |
| - eventHubName, |
52 |
| - consumerGroupName, |
53 |
| - eventHubConnectionString.toString(), |
54 |
| - storageConnectionString, |
55 |
| - storageContainerName); |
| 50 | + EventProcessorHost host = EventProcessorHostBuilder.newBuilder(EventProcessorHost.createHostName(hostNamePrefix), consumerGroupName) |
| 51 | + .useAzureStorageCheckpointLeaseManager(storageConnectionString, storageContainerName, "") |
| 52 | + .useEventHubConnectionString(eventHubConnectionString.toString(), eventHubName) |
| 53 | + .build(); |
56 | 54 |
|
57 | 55 | // Registering an event processor class with an instance of EventProcessorHost starts event processing. The host instance
|
58 | 56 | // obtains leases on some partitions of the Event Hub, possibly stealing some from other host instances, in a way that
|
|
0 commit comments