Azure / Azure/azure-service-bus-java

Azure event hub connection is closed error

Open
#420 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
62
Forks
63
PR merge metrics
No merged PRs in 30d

Description

I see something like the following error while using azure event hub to send event message. But as I see in the azure portal, the metric shows that the event message is sent to the event hub.

" Error{condition=amqp:connection:forced, description='The connection was inactive for more than the allowed 300000 milliseconds and is closed by container 'LinkTracker'. TrackingId:00000000000000000000000000000000000_G21, SystemTracker:gateway5, Timestamp:2019-03-06T17:32:00', info=null} "

As I read from the azure doc (https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-amqp-troubleshoot), it said "You see the following error on the AMQP connection when all links in the connection have been closed because there was no activity (idle) and a new link hasn't been created in 5 minutes."

The doc also said "You can avoid them by making send/receive calls on the connection/link, which automatically recreates the connection/link."

On another similar reported issue in https://github.com/Azure/azure-service-bus-java/issues/280, it appears that the above error log is only a reflection that the connection is being automatically closed, and so it is not actually an error.

On the other hand, I once tried that if I call the close() method in EventHubProducerClient (by refer to sample code in https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send), this error seems not appear again.

However, if doing so, when every time need to send the event, it will mean need to create a new EventHubProducerClient. I'm not sure if this may create another problem (like time required to create the new EventHubProducerClient, and memory consumption) if creating a new EventHubProducerClient for every send event, as there can be many events to send.

So I would like to know, will the above error lead to any issue ?

And what should be the best practice regarding the use of EventHubProducerClient, is it to create a new EventHubProducerClient for every event sending ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.