Azure/azure-event-hubs-node

Allow for policy changes from constructor

Closed this issue · 2 comments

We're using this library to send our logging from Azure Functions to the Event Hub. These functions are supposed to finish within seconds; they're part of a microservice architecture.

Currently, this library will attempt to reconnect forever when it is unable to establish a connection. The code has been set up that this is a non-blocking issue, however it would keep the node process alive in the background indefinitely (or at least until the connection is reestablished). We would prefer to just connect a couple of times and then disable Event Hub logging.

With the current library, I believe it's impossible to change the policy used to connect to Event Hub. Could you provide the constructor with an extra argument for allowing policy changes?

I came here to open a ticket for the same feature request, but I found this issue already existed, so I'm tagging along here.

In our case, we have found the need to override both maxMessageSize (when there was a bug that hardcoded it to 10K), and now the reattach fields retries, strategy, and forever.

We would welcome a change either to allow EventHubClient(config) to accept something in config that it can merge with the default AMQP policy for EventHubs, or to add a property to the connection string to specify the requested fields, which would then be merged into the default policy.

We're currently using fromConnectionString to create our clients, but we could switch to using the constructor if it's easier to make a change there instead.

@Weeknie @shpros - We have a new preview version "0.1.0" of the event hubs node.js client. This client was re-written from scratch. Please try the new version and let us know if you still see issues. You can find examples over here.