I would like to get MethodInvocation in RetryPolicy(probably via RetryContext) when available(invoked with MethodInvocationRetryCallback); so that, the policy can dynamically determine whether to retry based on the invoked method.
Since 1.3, MethodInvocationRetryCallback exposes MethodInvocation but it is only available to RetryListener.
The RetryListener#open could use this MethodInvocation; however, returning false here ends up TerminatedRetryException. So, this cannot be used to determine retry based on the invoked method.
My usecase is that I am writing a retry interceptor(MethodInterceptor) for transaction retry. It determines the retry based on the invoked method(TransactionDefinition applied on the invoked method/class).
Currently, in order to get invoked method, I apply ExposeInvocationInterceptor from spring to where spring advises for transactions. Then, my RetryPolicy retrieves the invoked method from ThreadLocal stashed by the ExposeInvocationInterceptor.
If MethodInvocation is available in RetryContext of RetryPolicy, I can directly acquire the invoked method and ExposeInvocationInterceptor is no longer required.
I would like to get
MethodInvocationinRetryPolicy(probably viaRetryContext) when available(invoked withMethodInvocationRetryCallback); so that, the policy can dynamically determine whether to retry based on the invoked method.Since 1.3,
MethodInvocationRetryCallbackexposesMethodInvocationbut it is only available toRetryListener.The
RetryListener#opencould use thisMethodInvocation; however, returningfalsehere ends upTerminatedRetryException. So, this cannot be used to determine retry based on the invoked method.My usecase is that I am writing a retry interceptor(
MethodInterceptor) for transaction retry. It determines the retry based on the invoked method(TransactionDefinitionapplied on the invoked method/class).Currently, in order to get invoked method, I apply
ExposeInvocationInterceptorfrom spring to where spring advises for transactions. Then, myRetryPolicyretrieves the invoked method fromThreadLocalstashed by theExposeInvocationInterceptor.If
MethodInvocationis available inRetryContextofRetryPolicy, I can directly acquire the invoked method andExposeInvocationInterceptoris no longer required.