You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2024/04/06 11:15:35 UTC

[I] Feature request: Add retry with predicate [pekko]

He-Pin opened a new issue, #1268:
URL: https://github.com/apache/pekko/issues/1268

   The current retry in pekko will trigger the retry when the future completes with an exception, but at $work, we may not want to retry for some exception/ value.
   
   I'm using something like :
   ```java
       @SneakyThrows
       public static <V> V retryWithBackoff(
           final Callable<V> callable,
           final Predicate<V> shouldRetryPredicate,
           final int maxRetryTime,
           final int sleepInMills,
           final String hint) {
           return retryWithBackoff0(callable, shouldRetryPredicate, maxRetryTime, 0, sleepInMills, hint);
       }
   ``` 
   usage:
   ```java
               result = RetryUtil.retryWithBackoff(
                   () -> bindTopic0(namespace, tagTopic, subscriber, subscriptionOptions),
                   r -> r != null
                       && ErrorConstants.ERR_HSF_CALL_ERROR.equals(r.getErrorCode())
                       && SwitchConfig.ENABLE_BIND_RETRY,
                   1,
                   5,
                   "bindTopic0");
   ```
   at work, but I think we can adjust that for Pekko too.
   
   where the `shouldRetryPredicate` can be a `(value,throwable) => Boolean`.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: Add retry with predicate [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #1268: Feature request: Add retry with predicate
URL: https://github.com/apache/pekko/issues/1268


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org