This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.25k
stars
1.93k
forks
source link
[BUG] When trying to connect to eventhub using connection string, the EventProcessorClient fails for Emulator #40938
Describe the bug
When trying to connect to Eventhub Emulator using connection string
It fails to make the connection since the EventProcessorClient tries to connect to secured AMQP port instead of the non secure one. The reason for this the connection string is not copied at the location
Using the following code snippet to make a connection to the eventhub.
Code Snippet
BlobContainerAsyncClient client = new BlobContainerClientBuilder().connectionString(
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1").containerName("eh1").buildAsyncClient();
client.createIfNotExists().block();
var eventProcessorClient = new EventProcessorClientBuilder().connectionString("Endpoint=sb://127.0.0.1;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;", hubName).checkpointStore(
new BlobCheckpointStore(client)).processEvent(event -> System.out.println(event)).processError(
error -> System.out.println(error)).consumerGroup("cg1").buildEventProcessorClient();
eventProcessorClient.start();
Expected behavior
When the connection string is given, use the connection string information to initialize the connection options in the copy of the EventHubClientBuilder.
Setup (please complete the following information):
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
Describe the bug When trying to connect to Eventhub Emulator using connection string
It fails to make the connection since the EventProcessorClient tries to connect to secured AMQP port instead of the non secure one. The reason for this the connection string is not copied at the location
EventHubClientBuilder com.azure.messaging.eventhubs.EventProcessorClientBuilder.copyOptions(EventHubClientBuilder source)
Exception or Stack Trace
To Reproduce Use the steps to spin up a Emulator instance with instructions at https://github.com/Azure/azure-event-hubs-emulator-installer/tree/main
Using the following code snippet to make a connection to the eventhub.
Code Snippet
Expected behavior When the connection string is given, use the connection string information to initialize the connection options in the copy of the EventHubClientBuilder.
Setup (please complete the following information):
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report