-
Notifications
You must be signed in to change notification settings - Fork 17
/
2020-08-24-mutiny-failure-handling.adoc.po
160 lines (136 loc) · 8.45 KB
/
2020-08-24-mutiny-failure-handling.adoc.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2022-05-12 15:52+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: YAML Front Matter: title
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy, no-wrap
msgid "How to handle failures with Mutiny"
msgstr "如何用Mutiny处理失败的情况"
#. type: YAML Front Matter: synopsis
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy, no-wrap
msgid "Failures are an inherent part of any software. This post explains how you handle them with Mutiny"
msgstr "失败是任何软件固有的一部分。这篇文章解释了你如何用Mutiny处理它们。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "In the past week, I got several questions about failure handling with Mutiny. So, maybe it deserves a bit more explanation."
msgstr "在过去的一周里,我收到了几个关于用Mutiny处理失败的问题。所以,也许它值得多解释一下。"
#. type: Title ==
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy, no-wrap
msgid "Failures are events"
msgstr "失败是事件"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "First, Mutiny is an event-driven reactive programming library. With Mutiny, you handle events. An upstream `Uni` or `Multi` propagates these events and gives you the possibility to process them. These events can be *item*, *completion*, *cancellation*, and... *failure*:"
msgstr "首先,Mutiny是一个事件驱动的反应式编程库。通过Mutiny,你可以处理事件。一个上游的 `Uni` 或 `Multi` 传播这些事件,并给你处理它们的可能性。这些事件可以是 *项目* , *完成* , *取消* ,以及...... *失败* 。"
#. type: Title ==
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy, no-wrap
msgid "What can you do when you receive a failure?"
msgstr "当你收到失败的消息时,你能做什么?"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "In addition to calling an action, as shown in the previous snippet, there are multiple things you can do when you receive a failure."
msgstr "除了调用一个动作外,如前面的片段所示,当你收到一个失败时,你可以做多种事情。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "The most common thing to do is to recover. You can recover by passing a specific item or with another `Uni`:"
msgstr "最常做的事情是恢复。你可以通过一个特定的项目或用另一个 `Uni` 来恢复。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "On Multi, you can also recover by providing another `Multi` or completing the stream:"
msgstr "在Multi上,你也可以通过提供另一个 `Multi` 或完成流来恢复。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "If you have faith in your system, you can also *retry*. Note that you need to make sure you can retry the operation safely first!"
msgstr "如果你对你的系统有信心,你也可以 *重试* 。请注意,你需要先确保你能安全地重试操作!"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "You can also transform the failure. For example, you can map a low-level failure into something more business-friendly. It propagates that second failure downstream, hiding the low-level failure:"
msgstr "你也可以转化失败。例如,你可以将一个低级别的故障映射成对业务更有利的东西。它将第二个故障向下游传播,隐藏低级故障。"
#. type: Title ==
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy, no-wrap
msgid "Failures are terminal"
msgstr "失败是终点"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "Failures are terminal events. If your upstream propagates a failure, it means it can't operate normally. For Uni, that's not a problem, as you can only have an item or a failure. But for multi, it's a bit more complicated."
msgstr "故障是终端事件。如果你的上游传播了一个故障,这意味着它不能正常运行。对于Uni来说,这不是一个问题,因为你只能有一个项目或一个失败。但对多人来说,这就有点复杂了。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "Even if you recover, by handling the failure, you won't get the rest of the stream. Your upstream is ... *kaputt*."
msgstr "即使你恢复了,通过处理失败,你也不会得到其余的流。你的上游是...... *kaputt* 。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "Let's take the following code:"
msgstr "让我们来看看下面的代码。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "It produces [1, 2, 3, 4, 5, 6, 7] and not the rest of the stream. When the `onItem().invoke()` stage is called with `7`, it produces a failure. That stops the stream. It does not process more items from upstream."
msgstr "它产生[1, 2, 3, 4, 5, 6, 7],而不是其余的流。当 `onItem().invoke()` 阶段被调用时, `7` ,它产生一个失败。这就停止了流。它不会处理更多来自上游的项目。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "So what can we do? Isolate!"
msgstr "那么我们能做什么?隔离!"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "When a *stage* sends a failure, it sends a failure terminating the stream and cancels its subscription to the upstream (informing that it does not need more items as it's not operating correctly). So, if we need to continue processing the other items from upstream; we just need to isolate that failure and be sure we do not cancel our subscription to the upstream."
msgstr "当一个 *阶段* 发送故障时,它就会发送一个终止流的故障,并取消它对上游的订阅(告知它不需要更多的项目,因为它的操作不正确)。因此,如果我们需要继续处理来自上游的其他项目;我们只需要隔离该故障并确保不取消对上游的订阅。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "The most common approach to achieve this is the following:"
msgstr "实现这一目标的最常见方法如下。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "Basically, we isolate the potentially failing operation. If it fails, we recover. But the cancellation only cancels that item, not the full stream, meaning we will receive the next one item and so on. This code produces the expected list."
msgstr "基本上,我们隔离了可能失败的操作。如果它失败了,我们就恢复。但是取消操作只取消了那个项目,而不是整个流,这意味着我们将收到下一个项目,以此类推。这段代码产生了预期的列表。"
#. type: Title ==
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy, no-wrap
msgid "Summary"
msgstr "摘要"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "Here you go, you can now handle failure and continue the streams gracefully."
msgstr "好了,你现在可以从容应对失败并继续流式传输了。"
#. type: Plain text
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "If you want to know more about Mutiny, check the following video:"
msgstr "如果您想进一步了解 Mutiny,请观看以下视频:"
#: _posts/2020-08-24-mutiny-failure-handling.adoc
#, fuzzy
msgid "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/kWlrGtwvOxg\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
msgstr "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/kWlrGtwvOxg\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"