Skip to content
Discussion options

You must be logged in to vote

I don't think this has anything to do with context propagation and everything to do with interceptor priorities. It turns out that @Transactional has lower priority than @Retry, so all retries happen in the same transaction. You can change that either by configuration, or by cleverly splitting the method into 2:

@Retry(maxRetries = 3, delay = 5000)
void checkAndDoFoo(Long id) {
    checkAndDoFoo0(id);
}

@Transactional
void checkAndDoFoo0(Long id) {
    // how to get a "current/fresh" Foo?
    Foo f = Foo.findById(id);
    if (f.status != Status.OPEN) {
        throw new RuntimeException("Still not open");
    }
    // do something with the "OPEN" foo...
}

Remember that the checkAndDoFoo0()

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@Ladicek
Comment options

Ladicek Mar 28, 2024
Collaborator

@sbeigel
Comment options

@sbeigel
Comment options

@Ladicek
Comment options

Ladicek Mar 28, 2024
Collaborator

@sbeigel
Comment options

Answer selected by sbeigel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment