Calling MessageReceiver.CloseAsync stops the reception of messages but also closes the underlying service bus connection without waiting for processing of messages that are already fetched and have a peek lock. The message handler is expected to cancel ongoing tasks when CloseAsync is called.
Expected Behavior
For my use case I cannot cancel processing of messages halfway. Each message must be processed exactly once and prcoessing must be complete. I would expect a functionality that allows the active message handler tasks to finish before the service bus connection is closed so that the messages can be properly completed.
In my understanding after reading the source code it would be sufficient to cancel the MessageReceivePump separately to closing the MessageReceiver. I am missing a method like UnregisterMessageHandler that would allow me to end automatic message reception without losing the connection.
Actual Behavior
Calling
MessageReceiver.CloseAsync
stops the reception of messages but also closes the underlying service bus connection without waiting for processing of messages that are already fetched and have a peek lock. The message handler is expected to cancel ongoing tasks whenCloseAsync
is called.Expected Behavior
For my use case I cannot cancel processing of messages halfway. Each message must be processed exactly once and prcoessing must be complete. I would expect a functionality that allows the active message handler tasks to finish before the service bus connection is closed so that the messages can be properly completed.
In my understanding after reading the source code it would be sufficient to cancel the
MessageReceivePump
separately to closing theMessageReceiver
. I am missing a method likeUnregisterMessageHandler
that would allow me to end automatic message reception without losing the connection.