ASB - allow configirable ack behaviour - allow ack post-read (current & brighter default), or on read (ASb default)
ASB currently reads and acks in one action (this is less chatty). This is also contra to other transports (rabbit/SQS) which ack post successful handle.
We should allow the behaviour to be configurable - to allow more guarenteed, but less performant (acc post-handle) or more perfomant (ack on read)
mentioned in #1438
@mustodomenico added this comment that's worth bearing in mind https://github.com/BrighterCommand/Brighter/pull/1438#issuecomment-801437587
@penderi I'll cast an eye over this, so effectively you want to Read, Lock, process, ACK/Fail?
yeah so you should be able to take the code mentioned in the comment and branch it behind a configuration value (that code was also in production for a while, the only reason we moved to ReadAndDelete was to save on cost and network traffic)
@iancooper I removed me thinking @preardon may be better. thought I could assign. yup. Could you assign to @preardon or me? Whomever best.
@preardon This behavior is the default for Brighter. So if receive just does a lock so others read past (different implementations on different platforms i.e. explicit lock on RMQ, VisibilityTimeout on SQS), then on acknowledge you ack/delete from the queue, you get default behavior. But, as it caused Spektrix pain, we want to make it configurable to AckOnRead as they have already, which would make Ack a no-op.
So on AzureServiceBusSubscription you want to add a property, as this is custom to this transport, like
public book AckOnRead {get; set;) = false
to control the behviour, and then pass that into your consumer via your consumerfactory (you need to cast the subscription passed to the consumerfactory to your derived type).
Then in your consumer code depending on this flag decide on the behaviour
@iancooper I think we can close this