0

We are using the amqp10 package for nodejs to receive messages from a queue on azure's service bus. We are sometimes getting an error

{ Error: read ETIMEDOUT at _errnoException (util.js:1022:11) at TLSWrap.onread (net.js:615:25) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }

but this is thrown around 12 minutes after it stops receiving messages. Is there a way to configure the timeout? We're using the provided service bus policy Policy.ServiceBusQueue.

The code is available here

njLT
  • 464
  • 6
  • 21

2 Answers2

0

Try setting a longer timeout with:

client.connect(uri, { idleTimeout: 120000 }).then(() => {
    // ...
})

The default value of idleTimeout is 120000 milliseconds.

Aaron Chen
  • 9,835
  • 1
  • 16
  • 28
  • shouldn't I be trying to reduce the timeout if I want it to reconnect earlier? I'm not sure why there is a delay of over 12 minutes before the error is thrown in the first place – njLT Feb 06 '18 at 09:51
  • 120,000ms is 120 seconds - 2 minutes. Not 12 minutes. – Johnathon Sullinger Mar 18 '18 at 21:25
0

You can leverage the subscribe method that is offered in version 7 of @azure/service-bus SDK if you want to receive the messages forever(you can stop receiving as needed).

It also handles the disconnects and reconnections gracefully and is capable of recovering even from fatal errors such as entity-not-found.

You can refer to the receiveMessagesStreaming.ts sample code that uses version 7 of @azure/service-bus SDK.

I know this is a late reply, but just in case someone is running into issues with the older service-bus node SDK and landed here, refer to the links below.

The latest version 7.0.0 of @azure/service-bus has been released recently.