added option to set the ReceiveMode of a service bus subscription#37
added option to set the ReceiveMode of a service bus subscription#37niemyjski merged 1 commit intoFoundatioFx:masterfrom global-roam:master
Conversation
|
LGTM, thanks for the pr! I'll merge this in but please leave a note how it works out for you. I'm wondering what will happen to the queue entries now that we don't delete them when we receive them (with your flag on). |
|
I will let you know once I have tested but it's my understanding that the combination of The source code for the message pump used by the subscription client would suggest this is the case too. So as far as I can tell the message would be deleted from the queue so long as the registered handler doesn't throw an exception. At least that's how the comments in the code read (the Microsoft documentation is a little light on detail). What I don't know yet is what happens in the event of an exception in the handler (meaning the message remains on the queue) and whether that message then gets delivered again (to the same receiver) once the peek lock is abandoned. For our usage I'm hoping it does. |
I have the need to ensure delivery of messages on the service bus and being able to configure the client to use
ReceiveMode.PeekLockto guarantee delivery.I think this change is all that is required. I'll admit that I haven't gone through thoroughly to see if there's any reason not to lock into using
ReceiveMode.ReceiveAndDeletebut as far as I can tell it should be fine.Also I included usage of the cancellation token into creating the subscription which seemed to make sense as well.