Azure Eventhub to web app (nodejs)

Hanna Instruments 1 Reputation point
2020-06-01T10:35:42.79+00:00

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
Azure Event Hubs
An Azure real-time data ingestion service.
591 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,437 Reputation points Microsoft Employee
    2020-06-12T22:29:50.85+00:00

    Hi @HannaInstruments-5090,

    After verifying with internal sources here is some additional info:

    1. 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
    2. 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://video2.skills-academy.com/en-us/javascript/api/@azure/event-hubs/eventhubconsumerclient?view=azure-node-latest#eventhubconsumerclient-string--string--checkpointstore--eventhubclientoptions-
    3. The timeout isn't currently configurable, but is set to 60 seconds.
    4. 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.