@Retryable and @Async com spring

Asked

Viewed 383 times

0

It is possible to create an asynchronous method that can be tried again if some exception occurs with spring?

@Retryable
@Async
public void myMethod() throws Exception {
    // Do some stuff
}
  • Yes, what problem are you having? Usually use with @Retryable in a separate method and it is called by the method executed asynchronously.

  • I would like to make the asynchronous execution of a method and if the execution failed, a new attempt would be made, to achieve this I created two classes the first with the method annotated with <code>@Async</code> and the second with the <code>@Retryable</code> method and I only delegate the function from the first to the second class.

  • You are trying to work with two processors at the same time. Have you thought about separating the invocation from the execution ?

  • A possible solution I imagined was split into two classes: one with Async calling the other with Retryable

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.