spring-data-dynamodb icon indicating copy to clipboard operation
spring-data-dynamodb copied to clipboard

How to handle strongly consistent reads non-globally?

Open efenderbosch opened this issue 6 years ago • 5 comments

My first idea was to add new annotation @StronglyConsistentRead but realized that whether or not you want strongly consistent reads might vary from call to call and a single repo method wouldn't allow that.

My second idea was to add WithConsistentRead to the method name to allow for an eventually consistent method and strongly consistent method.

Optional<T> findById(T id);
Optional<T> findByIdWithConsistentRead(T id);

If this seems like a reasonable solution, I might fork and give it a try.

efenderbosch avatar Apr 15 '19 18:04 efenderbosch

Ok, I just found the @Query annotation. I could add boolean stronglyConsistent() default false there, but then would need a way to ignore a part of the method name so the two methods above could both exist in the same interface.

efenderbosch avatar Apr 15 '19 18:04 efenderbosch

@efenderbosch this will be useful is there a PR or has this already been implemented .

gauravbrills avatar Nov 22 '19 18:11 gauravbrills

I was considering implementing, but looking for guidance on how best to do it. Some input from the devs would be helpful.

efenderbosch avatar Nov 25 '19 17:11 efenderbosch

I was considering implementing, but looking for guidance on how best to do it. Some input from the devs would be helpful.

some annotation like @consistentReads over the methods looks better to me as we would not want to change the spring data constructs here .

gauravbrills avatar Nov 25 '19 19:11 gauravbrills

Hi, I'm wondering the same thing. Is there any update on how to handle strongly consistent reads?

egaldamez avatar Nov 04 '20 17:11 egaldamez