[BUG] Using EventHubProducerClient with AMQP_WEB_SOCKETS and custom Endpoint Address results in timeout
See original GitHub issueDescribe the bug Using EventHubProducerClient with AMQP_WEB_SOCKETS and custom Endpoint Address results in timeout
Exception or Stack Trace Exception in thread “main” java.lang.IllegalStateException: Timeout on blocking read for 60000000000 NANOSECONDS at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:123) at reactor.core.publisher.Mono.block(Mono.java:1731) at com.azure.messaging.eventhubs.EventHubProducerClient.createBatch(EventHubProducerClient.java:199) at com.example.App.main(App.java:36)
To Reproduce Run the following code.
Code Snippet
package com.example;
import com.azure.core.credential.TokenCredential;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.azure.messaging.eventhubs.*;
import java.util.Arrays;
import java.util.List;
import static java.nio.charset.StandardCharsets.UTF_8;
public class App
{
public static void main( String[] args )
{
List<EventData> telemetryEvents = Arrays.asList(
new EventData("Roast beef".getBytes(UTF_8)),
new EventData("Cheese".getBytes(UTF_8)),
new EventData("Tofu".getBytes(UTF_8)),
new EventData("Turkey".getBytes(UTF_8)));
TokenCredential credential = new DefaultAzureCredentialBuilder()
.build();
EventHubProducerClient producer = new EventHubClientBuilder()
.credential(
"Event Hub Namespace Name",
"Event Hub Name",
credential)
.transportType(AmqpTransportType.AMQP_WEB_SOCKETS)
.customEndpointAddress("https://<event hub custom endpoint>")
.buildProducerClient();
EventDataBatch currentBatch = producer.createBatch();
for (EventData event : telemetryEvents) {
if (currentBatch.tryAdd(event)) {
continue;
}
// The batch is full, so we create a new batch and send the batch.
producer.send(currentBatch);
currentBatch = producer.createBatch();
// Add that event that we couldn't before.
if (!currentBatch.tryAdd(event)) {
System.err.printf("Event is too large for an empty batch. Skipping. Max size: %s. Event: %s%n",
currentBatch.getMaxSizeInBytes(), event.getBodyAsString());
}
}
producer.send(currentBatch);
System.out.println("Java OK!");
}
}
Expected behavior Connection should be established and messages should flow.
Setup (please complete the following information):
- OS: Windows & Linux
- IDE: Visual Studio Code
- Library/Libraries: azure-messaging-eventhubs:5.13.1
- Java version: openjdk 17.0.4.1 2022-08-12
- App Server/Environment: Event Hubs, Application Gateway
- Frameworks: -
Additional context An Event Hub with a private endpoint, is sitting behind and Application Gateway. Same sample written using .NET is working as expected.
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
- Bug Description Added
- Repro Steps Added
- Setup information Added
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
@anuchandy is investigating this based on an internal work item.
The root cause is here. PR to address it is opened, which should be released in November-2022 version.