Azure / azure-event-hubs-node

Node client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
MIT License
50 stars 46 forks source link

Missing emitted event for onClose() or onShutdown() #173

Closed jrauschenbusch closed 5 years ago

jrauschenbusch commented 5 years ago

Is your feature request related to a problem? Please describe. To enable the state handling of multiple EPH instances inside an application it would be great to have the opportunity to get notified as soon as an EPH instance is getting stopped to whatever reason (e.g. error during partition management, removal of an EventHub, etc.)

Describe the solution you'd like An additional onClose() or onShutdown() handler signature inside the FromTokenProviderOptions API. Maybe the passed parameter could be an enumerated CloseReason.

Maybe _context.partitionManager._runTask.then(() => ...) is the right place for this feature.

Describe alternatives you've considered The returned Promise of the start() method is not sufficient as it only indicates that the EPH has started properly.

vaish1707 commented 5 years ago

I think this is really a good point to be covered in this module. Even I was looking for something similar to this. I'm planning to checkpoint the messages whenever the eventprocessor host instance stops all of a sudden. But I'm not sure on how I can get to know that the shutdown has happened. for example: notify about the shutdown through any event or any error type. Something similar to IEventProcessor.onClose/IEventProcessor.CloseAsync in dotnet eventprocessorhost lib

ramya-rao-a commented 5 years ago

@jrauschenbusch, @vaish1707 Thanks for reporting and apologies in the delay for responding to this issue.

The start() method takes a onError handler as well. My assumption is that the callback you provide here is called for any error that occurs in the EPH. Will this not suffice for you to be notified of any issues with the EPH?

vaish1707 commented 5 years ago

Sure. I'll check that. @ramya-rao-a Is it possible that you can help me out with the other issue that I have raised ? https://github.com/Azure/azure-event-hubs-node/issues/210 .

ramya-rao-a commented 5 years ago

Closing this issue as the user provided onError handler is indeed called for any error during event processing.