question

HannaInstruments-5090 avatar image
0 Votes"
HannaInstruments-5090 asked ·

Azure Eventhub to web app (nodejs)

To subscribe data using azure event hub, We are using @azure/event-hubs node js module version 5.2.0. Few questions we need to understand, mentioned below. 1) We are receiving "EventHub receiver OperationTimeoutError: Unable to create the amqp session due to operation timeout." , Error How to resolve this? 2) From this link https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventhub/event-hubs , We found guidance around retries just want to know is there any retry policy of event hub or manual we have retry when error occur, If manual then where we need to add retryOptions 3) How to increase event hub connection timeout ? 4) If no data subscribe then event hub receiver will be close automatically? If yes then, How to start to receive the data.


azure-event-hubs
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @HannaInstruments-5090,


Thanks for reaching out and sincere apologies for delay in my response.

If you look at the Prerequisites section of the sample you referred to, it is recommended to use Node.js 8.x or higher if you are using this package in a Node.js application. Could you please try with Node.js 8.x or higher and let us know if you still experience the issue?



Thank you


0 Votes 0 · ·

1 Answer

KranthiPakala-MSFT avatar image
0 Votes"
KranthiPakala-MSFT answered ·

Hi @HannaInstruments-5090,


After verifying with internal sources here is some additional info:


Azure SDK team released a new version (v5.2.1) of the event-hubs package this week that has some improvements around recovering from connection issues that the customers/users should consider upgrading to.
Changelog: https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/CHANGELOG.md#521-2020-06-08


When receiving events, the user doesn't need to retry in the event an error occurs, the EventHubConsumerClient will automatically retry.
• This works in two different ways depending on if the error that's shown in processError has its retryable field set to true or not.
• If error.retryable is undefined or false, then the client will next call processClose if the user has provided it.
• If the user is using a checkpointstore (e.g. eventhubs-checkpointstore-blob) to store event checkpoints, then after ~10 seconds, the client will check if any other clients have started reading from the partition that received an error, and if not, attempt to read again. If the user is not using a checkpointstore, then after ~10 seconds the client will attempt to read again regardless.
• At this point, the user's processInitialize will be called, and then the user should start seeing events as they become available.
• One thing to note though is that in this process, the client will resume reading events from the last known checkpoint for the partition. If the user isn't calling context.updateCheckpoint(event) in their code, then this resume from the startPosition, which is defaulted to latest.
• If error.retryable is true, then the process is simpler. The client won't call processClose, and instead continue attempting to read events from where it left off.
• The user may pass in retryOptions to the EventHubConsumerClient constructor if they want to tweak the defaults, but the client will always attempt to retry as described above until the user calls subscription.close().
EventHubConsumerClient options: https://docs.microsoft.com/en-us/javascript/api/@azure/event-hubs/eventhubconsumerclient?view=azure-node-latest#eventhubconsumerclient-string--string--checkpointstore--eventhubclientoptions-


The timeout isn't currently configurable, but is set to 60 seconds.


The EventHubConsumerClient will not close automatically when there is no data available. The user will actually see processEvents called periodically (60 seconds by default) with an empty array if no events are available.


Hope this info helps.




Thank you


Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members.


· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @HannaInstruments-5090,

Just checking to see if the above info was helpful. If this answers your query, please do consider to click “Accept Answer” and "Up-Vote" as it might be beneficial to other community members reading this thread. And, if you have any further query do let us know.

0 Votes 0 · ·

Hi @HannaInstruments-5090,

Following up to see if your issue was resolved? In case if you have found a different solution, please do consider to share it here with community.



Thank you

0 Votes 0 · ·