-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutbound.html
More file actions
353 lines (342 loc) · 11.6 KB
/
outbound.html
File metadata and controls
353 lines (342 loc) · 11.6 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Outbound Message Flow — Intergov Ledger 0.1.0 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Inbound Message Flow" href="inbound.html" />
<link rel="prev" title="Event Subsystem" href="events.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="inbound.html" title="Inbound Message Flow"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="events.html" title="Event Subsystem"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Intergov Ledger 0.1.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="outbound-message-flow">
<h1>Outbound Message Flow<a class="headerlink" href="#outbound-message-flow" title="Permalink to this headline">¶</a></h1>
<p>These components are involved in the flow of messages
from one Government to another.
Specifically, the sending side of the equation.</p>
<div class="section" id="multichannel-router">
<h2>Multichannel Router<a class="headerlink" href="#multichannel-router" title="Permalink to this headline">¶</a></h2>
<p>This is a core component.
It is responsible for routing messages between Governments
(using the appropriate channel).</p>
<p>Note: channels abstract over topology, technology and wire protocols.
This means that countries are free
to determine bilaterally or multilaterally
agreeable channels.
This component will be configured to use the channels
as per the operating countries agreements.</p>
<p class="plantuml">
<img src="_images/plantuml-edcd6375f018de6b6b5214695c596a43e33da651.png" alt="@startuml
component router [
Multi-Channel
Router
]
usecase uc [
Route To
Channel
]
router -- uc
queue ch1 [
channel 1
]
queue ch2 [
channel 2
]
queue chx [
channel ...
]
boundary rt [
routing
table
]
uc -- rt
rt -- ch1
rt -- ch2
rt -- chx
database outbox [
delivery
outbox
]
boundary outbox_patch [
patch
message
]
outbox_patch -- outbox
router -- outbox_patch
boundary outbox_get [
get
message
]
router -- outbox_get
outbox_get -- outbox
boundary post_pcm [
post
job
]
router -- post_pcm
database pcm_repo [
channel
pending
]
post_pcm -- pcm_repo
boundary push_mu [
patch
]
router -- push_mu
database mu_repo [
delivery
status
]
push_mu -- mu_repo
@enduml"/>
</p>
<p>This process needs to be slightly more complicated
than it might seem at first.
Channels need to be potentially asynchronous.
For example, with a blockchain channel,
messages are "written" to the extent of the consensus.
It's technically possible for blockchains to fork,
meaning that the concensus "changes it's mind"
about the shared view of history.</p>
<p>This means that,
in addition to routing the message to the channel,
the router must also dispatch a couple of jobs
(asynchronous processing tasks):</p>
<ul class="simple">
<li><p>"Channel Pending" jobs are used keep track of messages
that may not yet have been sucessfully delivered by the channel.
Depending on the outcome of channel processing,
the appropriate steps for processing these messages
may not yet be known.</p></li>
<li><p>"Delivery Status" journal is updated
to keep track of the channel delivery status
so stakeholder processes can remain appraised
of important delivery/non-delivery events.</p></li>
</ul>
</div>
<div class="section" id="channel-poller">
<h2>Channel Poller<a class="headerlink" href="#channel-poller" title="Permalink to this headline">¶</a></h2>
<p>Not to be confused with the Channel Observer:
This worker checks on the status of messages
that have been sent to a channel BY US
(the other one discovers new messages
that have been sent on a channel TO US).</p>
<p class="plantuml">
<img src="_images/plantuml-37bb1f3dfcd1a439683e1f99d181aedec06a7ea5.png" alt="@startuml
component worker [
Channel
Poller
]
usecase uc [
Check Status of
Pending Deliveries
]
worker -- uc
queue channel
database pending [
pending
deliveries
]
boundary check [
check
status
]
uc -- check
check -- channel
boundary get [
get
]
uc -- get
get -- pending
boundary del [
delete
]
uc --del
del -- pending
database updates [
message
updates
]
boundary post [
post
job
]
uc -- post
post -- updates
@enduml"/>
</p>
<p>This worker deletes jobs from the "pending messages" queue
when an change is detected (by polling the channel).
If no change is detected,
the job is not deleted from the pending messages queue.
But neither is it returned to the queue -
the worker holds a lock on the job until it goes stale.
This way, the worker polls the queue sequentially
at most once per task timeout period configured on the queue.</p>
<p>It's a bit of a cheap trick but it seems to work quite well.</p>
</div>
<div class="section" id="rejected-message-processor">
<h2>Rejected Message Processor<a class="headerlink" href="#rejected-message-processor" title="Permalink to this headline">¶</a></h2>
<p>When the multi channel router tries to send a message to a channel,
there are various reasons why the attempt might fail.
Because the process is asynchronous,
the sending component (multi channel router)
does not wait to know the status,
it just carries on sending.</p>
<p>That is why the channel poller component
manages data in the "pending deliveries" database
and posts update jobs to the "message updates" queue.
Thus, message updates queue contains jobs to be done
updating the delivery status of messages.</p>
<p>The task of this component
(rejected message processor)
is to process those jobs.</p>
<dl class="class">
<dt id="intergov.processors.rejected_status_updater.RejectedStatusUpdater">
<em class="property">class </em><code class="sig-prename descclassname">intergov.processors.rejected_status_updater.</code><code class="sig-name descname">RejectedStatusUpdater</code><span class="sig-paren">(</span><em class="sig-param">rejected_message_repo_conf=None</em>, <em class="sig-param">message_lake_repo_conf=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/intergov/processors/rejected_status_updater.html#RejectedStatusUpdater"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#intergov.processors.rejected_status_updater.RejectedStatusUpdater" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over RejectPendingMessageUseCase</p>
</dd></dl>
<p class="plantuml">
<img src="_images/plantuml-9430b19c536825948e64ba2d9071d37dfd809cf4.png" alt="@startuml
component rsu [
Rejected
Message
Processor
]
usecase uc [
Process
Rejected
Message
]
rsu -- uc
boundary umd [
update
metadata
]
uc -- umd
database ml [
message
lake
]
umd -- ml
boundary get [
get
]
uc -- get
boundary delete [
delete
]
uc -- delete
database rm [
rejected
messages
]
get -- rm
delete -- rm
@enduml"/>
</p>
<dl class="class">
<dt id="intergov.use_cases.reject_pending_message.RejectPendingMessageUseCase">
<em class="property">class </em><code class="sig-prename descclassname">intergov.use_cases.reject_pending_message.</code><code class="sig-name descname">RejectPendingMessageUseCase</code><span class="sig-paren">(</span><em class="sig-param">rejected_message_repo</em>, <em class="sig-param">message_lake_repo</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/intergov/use_cases/reject_pending_message.html#RejectPendingMessageUseCase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#intergov.use_cases.reject_pending_message.RejectPendingMessageUseCase" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a single message from rejected message repo
If rejected message payload is valid - has sender, sender_ref fields
updates message metadata by changing status to rejected via message lake repo
update_metadata method</p>
<dl class="simple">
<dt>Fails if:</dt><dd><ol class="arabic simple">
<li><p>unable to update message status</p></li>
<li><p>rejected message payload is invalid</p></li>
</ol>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Outbound Message Flow</a><ul>
<li><a class="reference internal" href="#multichannel-router">Multichannel Router</a></li>
<li><a class="reference internal" href="#channel-poller">Channel Poller</a></li>
<li><a class="reference internal" href="#rejected-message-processor">Rejected Message Processor</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="events.html"
title="previous chapter">Event Subsystem</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="inbound.html"
title="next chapter">Inbound Message Flow</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/outbound.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="inbound.html" title="Inbound Message Flow"
>next</a> |</li>
<li class="right" >
<a href="events.html" title="Event Subsystem"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Intergov Ledger 0.1.0 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2019, Commonwealth of Australia.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.0.
</div>
</body>
</html>