Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Graceful shutdown when using RegisterSessionHandler / RegisterSessionHandlerFactory

$
0
0

I have some QueueClient / SubscriptionClients which are using the RegisterSessionHandler / RegisterSessionHandlerFactory methods to handle the session handling. I'm struggling to see how I can close all of this down gracefully. 

At the moment, I just have to call the Close method of my QueueClient / SubscriptionClient. This causes chaos within by session handlers - some may be in the middle of processing a message, but won't be able to 'Complete' it, causing exceptions to throw and the message to be left on the queue. This also all seems to happen after the Close method returns, which means the handlers may be running after I've asked them to stop. 

I had assumed 'Close' would first stop accepting sessions, let the current session handlers finally their current message, and then return... but that doesn't seem to be the case? Surely there is a better way to do this?



Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>