Skip to content

Commit

Permalink
Updates for 3.0.0 RBAC release
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesBirdsall committed Jul 1, 2019
1 parent 37cf05a commit 118133b
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 213 deletions.
2 changes: 1 addition & 1 deletion samples/Java/Basic/AdvancedSendOptions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static void main(String[] args)

// Each EventHubClient instance spins up a new TCP/SSL connection, which is expensive.
// It is always a best practice to reuse these instances. The following sample shows the same.
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString(), executorService);
final EventHubClient ehClient = EventHubClient.createFromConnectionStringSync(connStr.toString(), executorService);
PartitionSender sender = null;

try {
Expand Down
28 changes: 0 additions & 28 deletions samples/Java/Basic/EventProcessorSample/.classpath

This file was deleted.

23 changes: 0 additions & 23 deletions samples/Java/Basic/EventProcessorSample/.project

This file was deleted.

4 changes: 2 additions & 2 deletions samples/Java/Basic/EventProcessorSample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs-eph</artifactId>
<version>2.5.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.microsoft.azure.eventprocessorhost.ExceptionReceivedEventArgs;
import com.microsoft.azure.eventprocessorhost.IEventProcessor;
import com.microsoft.azure.eventprocessorhost.PartitionContext;
import com.microsoft.azure.eventprocessorhost.EventProcessorHost.EventProcessorHostBuilder;

import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
Expand Down Expand Up @@ -43,16 +44,13 @@ public static void main(String args[]) throws InterruptedException, ExecutionExc
.setSasKeyName(sasKeyName)
.setSasKey(sasKey);

// Create the instance of EventProcessorHost using the most basic constructor. This constructor uses Azure Storage for
// Create the instance of EventProcessorHost using the builder. This sample uses Azure Storage for
// persisting partition leases and checkpoints. The host name, which identifies the instance of EventProcessorHost, must be unique.
// You can use a plain UUID, or use the createHostName utility method which appends a UUID to a supplied string.
EventProcessorHost host = new EventProcessorHost(
EventProcessorHost.createHostName(hostNamePrefix),
eventHubName,
consumerGroupName,
eventHubConnectionString.toString(),
storageConnectionString,
storageContainerName);
EventProcessorHost host = EventProcessorHostBuilder.newBuilder(EventProcessorHost.createHostName(hostNamePrefix), consumerGroupName)
.useAzureStorageCheckpointLeaseManager(storageConnectionString, storageContainerName, "")
.useEventHubConnectionString(eventHubConnectionString.toString(), eventHubName)
.build();

// Registering an event processor class with an instance of EventProcessorHost starts event processing. The host instance
// obtains leases on some partitions of the Event Hub, possibly stealing some from other host instances, in a way that
Expand Down
2 changes: 1 addition & 1 deletion samples/Java/Basic/ReceiveByDateTime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args)
.setSasKey("---SharedAccessSignatureKey----");

final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(4);
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString(), executorService);
final EventHubClient ehClient = EventHubClient.createFromConnectionStringSync(connStr.toString(), executorService);

final EventHubRuntimeInformation eventHubInfo = ehClient.getRuntimeInformation().get();
final String partitionId = eventHubInfo.getPartitionIds()[0]; // get first partition's id
Expand Down
2 changes: 1 addition & 1 deletion samples/Java/Basic/ReceiveUsingSequenceNumber/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void main(String[] args)
.setSasKey("---SharedAccessSignatureKey----");

final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(4);
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString(), executorService);
final EventHubClient ehClient = EventHubClient.createFromConnectionStringSync(connStr.toString(), executorService);

final EventHubRuntimeInformation eventHubInfo = ehClient.getRuntimeInformation().get();
final String partitionId = eventHubInfo.getPartitionIds()[0]; // get first partition's id
Expand Down
2 changes: 1 addition & 1 deletion samples/Java/Basic/SendBatch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args)

final Gson gson = new GsonBuilder().create();
final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(4);
final EventHubClient sender = EventHubClient.createSync(connStr.toString(), executorService);
final EventHubClient sender = EventHubClient.createFromConnectionStringSync(connStr.toString(), executorService);

try {
for (int batchNumber = 0; batchNumber < 10; batchNumber++) {
Expand Down
2 changes: 1 addition & 1 deletion samples/Java/Basic/SimpleProxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion samples/Java/Basic/SimpleSend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args)

// Each EventHubClient instance spins up a new TCP/SSL connection, which is expensive.
// It is always a best practice to reuse these instances. The following sample shows this.
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString(), executorService);
final EventHubClient ehClient = EventHubClient.createFromConnectionStringSync(connStr.toString(), executorService);

try {
for (int i = 0; i < 100; i++) {
Expand Down
2 changes: 1 addition & 1 deletion samples/Java/Benchmarks/AutoScaleOnIngress/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CompletableFuture<Void> initialize() throws IOException, EventHubExceptio
final CompletableFuture[] createSenders = new CompletableFuture[this.poolSize];
for (int count = 0; count < poolSize; count++) {
final int clientsIndex = count;
createSenders[count] = EventHubClient.create(this.connectionString, executorService).thenAccept(new Consumer<EventHubClient>() {
createSenders[count] = EventHubClient.createFromConnectionString(this.connectionString, executorService).thenAccept(new Consumer<EventHubClient>() {
@Override
public void accept(EventHubClient eventHubClient) {
clients[clientsIndex] = eventHubClient;
Expand Down
2 changes: 1 addition & 1 deletion samples/Java/Benchmarks/IngressBenchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.3.0</version>
<version>3.0.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CompletableFuture<Void> initialize() throws IOException, EventHubExceptio
final CompletableFuture[] createSenders = new CompletableFuture[this.poolSize];
for (int count = 0; count < poolSize; count++) {
final int clientsIndex = count;
createSenders[count] = EventHubClient.create(this.connectionString, executorService).thenAccept(new Consumer<EventHubClient>() {
createSenders[count] = EventHubClient.createFromConnectionString(this.connectionString, executorService).thenAccept(new Consumer<EventHubClient>() {
@Override
public void accept(EventHubClient eventHubClient) {
clients[clientsIndex] = eventHubClient;
Expand Down

3 comments on commit 118133b

@elonmallin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JamesBirdsall Hi, I got a problem with the Microsoft learn material at link because of this change it seems.

There is no com.microsoft.azure:azure-eventhubs:jar:3.0.0 package when I try to build with Maven. And I can't find it either. It seems like the latest version is 2.3.2?

Sorry, couldn't create an issue, this repo seems to not allow it.

@JamesBirdsall
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elonmallin We're still working to get the 3.0.0 release with RBAC support out the door. The sample was updated early by accident. Sorry for the confusion!

@sanq2
Copy link

@sanq2 sanq2 commented on 118133b Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JamesBirdsall Hi, James. I have also some problem this sample source build.
One is com.microsoft.azure:azure-eventhubs:jar:3.0.0 and other one is build error.

  • EventProcessorSample code build error
EventProcessorHostBuilder cannot be resolved : /eventprocessorsample/src/main/java/com/microsoft/azure/eventhubs/samples/eventprocessorsample/EventProcessorSample.java
The import com.microsoft.azure.eventprocessorhost.EventProcessorHost.EventProcessorHostBuilder cannot be resolved : /eventprocessorsample/src/main/java/com/microsoft/azure/eventhubs/samples/eventprocessorsample/EventProcessorSample.java

I think this source have a some problem. Could you maintenance this repository?

Please sign in to comment.