Results 1 to 10 of 10

Thread: Retry around Serviceinvoker with SimpleRetryPolicy exception classification

Hybrid View

  1. #1

    Default Retry around Serviceinvoker with SimpleRetryPolicy exception classification

    Hi All,

    I want to retry a method annotated with ServiceActivator when some specific exceptions are thrown.
    I've tried adding a RetryInterceptor to the message listener container advice chain, however the exception propgated from the service method is wrapped in a ListenerExecutionFailedException which renders the exception classification in SimpleRetryPolicy fairly useless.

    I saw some examples where the advice is put in a poller inside a service-activator element, but that didn't work for me (got an error about trying to use a poller with a subscribable channel).

    Am I missing something?

    Thanks!

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    In 2.2, we have introduced the ability to apply a retry advice to individual components...

    http://blog.springsource.org/2012/10...etry-and-more/

    Release candidate 2 (2.2.0.RC2) is available; the release should be available shortly.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3

    Default

    Thanks, I saw indeed that it changed in 2.2, but I'm still using 2.1.
    For now I'm using RetryTemplate programmatically, and will eagerly await the 2.2 release.

  4. #4

    Default RequestHandlerRetryAdvice wraps Exception in a MessagingException?

    I've just upgraded to 2.2.1 and trying to use RequestHandlerRetryAdvice.
    I've noticed that the RetryCallback that it creates catches any exception from the invoked service and wraps it in a MessagingException, again rendering my SimpleRetryPolicy exception check useless.

    Do I need to extend RequestHandlerRetryAdvice and override the invoke method?

  5. #5
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    Hi!

    What's problem to get cause in your RetryPolicy:
    Code:
    public boolean canRetry(RetryContext context) {
            Throwable t = context.getLastThrowable().getCause();
            ...
    }
    ?

    Cheers,
    Artem

  6. #6

    Default

    Artem,

    context.getLastThrowable() will return a MessagingException that wraps the actual exception (any exception) thrown by the business code. This makes using the default exception classifier in SimpleRetryPolicy impossible.

    Why does the RetryCallback created by RequestHandlerRetryAdvice wraps the actual exception with a MessagingException?

    Thanks,
    Assaf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •