重试Akka流图 [英] Akka stream map with retry

查看:85
本文介绍了重试Akka流图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果流中元素的映射/处理失败,如何重试?

How can i retry if mapping/processing of an element in the stream fails?

我尝试在实现器中设置决策程序,但不提供重试。它只是将异常映射到监督阶段。

I have tried setting the decider in materializer but it does not offer retry. It simply maps exception to Supervision stage.

谢谢

推荐答案

来自akka-stream 2.4。 4 ,您可以使用 recoverWithRetries (docs 这里)。

From akka-stream 2.4.4 you can use recoverWithRetries (docs here).

这基本上可以让您提供


  1. 重试尝试次数

  2. 根据发生的故障切换到其他来源

它既可用于 Source ,又可用于 Flow

It's available for both Source and Flow.

这篇关于重试Akka流图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆