Brighter icon indicating copy to clipboard operation
Brighter copied to clipboard

ASB - allow configirable ack behaviour - allow ack post-read (current & brighter default), or on read (ASb default)

Open penderi opened this issue 5 years ago • 6 comments

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

penderi avatar Mar 18 '21 17:03 penderi

@mustodomenico added this comment that's worth bearing in mind https://github.com/BrighterCommand/Brighter/pull/1438#issuecomment-801437587

penderi avatar Mar 18 '21 20:03 penderi

@penderi I'll cast an eye over this, so effectively you want to Read, Lock, process, ACK/Fail?

preardon avatar Mar 19 '21 09:03 preardon

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)

mustodomenico avatar Mar 19 '21 11:03 mustodomenico

@iancooper I removed me thinking @preardon may be better. thought I could assign. yup. Could you assign to @preardon or me? Whomever best.

penderi avatar Mar 19 '21 15:03 penderi

@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 avatar Mar 19 '21 15:03 iancooper

@iancooper I think we can close this

preardon avatar Apr 29 '21 21:04 preardon