question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Using EventHubProducerClient with AMQP_WEB_SOCKETS and custom Endpoint Address results in timeout

See original GitHub issue

Describe 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:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
connieycommented, Oct 24, 2022

@anuchandy is investigating this based on an internal work item.

1reaction
anuchandycommented, Oct 30, 2022

The root cause is here. PR to address it is opened, which should be released in November-2022 version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot connectivity issues - Azure Event Hubs
This article provides information on troubleshooting connectivity issues with Azure Event Hubs.
Read more >
Using @azure/event-hubs sending message always run into a ...
I get to the point when the user/client needs allow the azure application. But after then when I am using the created producer...
Read more >
azure-eventhub - PyPI
For the Event Hubs client library to interact with an Event Hub, the easiest means is to use a connection string, which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found