Add documentation details on the Message producer

Signed-off-by: Akashdeep Dhar <akashdeep.dhar@gmail.com>
This commit is contained in:
Akashdeep Dhar 2024-03-28 10:04:29 +05:30
parent d26a4db3b0
commit 26298fbed0
3 changed files with 201 additions and 0 deletions

View file

@ -0,0 +1,142 @@
<mxfile host="app.diagrams.net" modified="2024-03-28T04:06:26.764Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0" etag="ziqQ5XbiaGtbYr4BaQlu" version="24.2.0" type="device">
<diagram name="Page-1" id="qv9GysurAzakRIHCpZtG">
<mxGraphModel dx="1969" dy="624" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="qASsJMXoT1ADjvtwPi7K-15" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-1" target="qASsJMXoT1ADjvtwPi7K-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-17" value="&lt;font style=&quot;font-size: 8px;&quot; face=&quot;JetBrains Mono&quot;&gt;Seeking verification&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-15">
<mxGeometry x="-0.1759" relative="1" as="geometry">
<mxPoint y="7" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-44" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-1" target="qASsJMXoT1ADjvtwPi7K-5">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-20" y="290" />
<mxPoint x="-20" y="180" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-45" value="&lt;font face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;&lt;b&gt;SUCCESS RESPONSE&lt;/b&gt;&lt;br&gt;HTTP 200&lt;br&gt;UUID and DIGEST&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-44">
<mxGeometry x="-0.0218" y="1" relative="1" as="geometry">
<mxPoint x="1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-46" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0.996;exitY=0.341;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-1" target="qASsJMXoT1ADjvtwPi7K-5">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="240" y="290" />
<mxPoint x="380" y="290" />
<mxPoint x="380" y="180" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-47" value="&lt;font face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;&lt;b&gt;FAILURE RESPONSE&lt;br&gt;&lt;/b&gt;HTTP 400, HTTP 401, HTTP 403,&lt;br&gt;HTTP 409 and HTTP 500&lt;br&gt;ERROR MESSAGE&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-46">
<mxGeometry x="-0.0142" y="-1" relative="1" as="geometry">
<mxPoint y="-10" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-1" value="&lt;font style=&quot;font-size: 10px;&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot;&gt;&lt;b&gt;API SERVICE&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="120" y="280" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-8" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-5" target="qASsJMXoT1ADjvtwPi7K-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-9" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;Event Invocation Request&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-8">
<mxGeometry x="0.0498" y="-1" relative="1" as="geometry">
<mxPoint x="1" y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-5" value="&lt;font style=&quot;font-size: 10px;&quot; face=&quot;JetBrains Mono&quot;&gt;&lt;b&gt;WEBHOOK SERVICE&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="120" y="160" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-21" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-13" target="qASsJMXoT1ADjvtwPi7K-20">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-22" value="&lt;font style=&quot;font-size: 8px;&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot;&gt;Success&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-21">
<mxGeometry x="-0.1031" y="-2" relative="1" as="geometry">
<mxPoint y="2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-34" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.75;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-13" target="qASsJMXoT1ADjvtwPi7K-1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="380" y="420" />
<mxPoint x="380" y="310" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-35" value="&lt;font face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;Failure&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-34">
<mxGeometry x="0.0222" y="3" relative="1" as="geometry">
<mxPoint x="-97" y="60" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-13" value="&lt;font style=&quot;font-size: 10px;&quot; face=&quot;JetBrains Mono&quot;&gt;&lt;b style=&quot;&quot;&gt;VERIFICATION&lt;/b&gt;&lt;/font&gt;" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" vertex="1" parent="1">
<mxGeometry x="120" y="400" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-32" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.75;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-20" target="qASsJMXoT1ADjvtwPi7K-1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-33" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;Response to API service&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-32">
<mxGeometry x="-0.6289" relative="1" as="geometry">
<mxPoint y="3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-51" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-20" target="qASsJMXoT1ADjvtwPi7K-24">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-52" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;Message shared&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-51">
<mxGeometry x="0.1186" y="-1" relative="1" as="geometry">
<mxPoint x="12" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-20" value="&lt;font style=&quot;font-size: 10px;&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot;&gt;&lt;b&gt;MESSAGE PRODUCER&lt;/b&gt;&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="-80" y="400" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-53" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-24" target="qASsJMXoT1ADjvtwPi7K-20">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-330" y="460" />
<mxPoint x="-50" y="460" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-54" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;Production bus response&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-53">
<mxGeometry x="-0.1237" y="2" relative="1" as="geometry">
<mxPoint x="13" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-24" value="&lt;font style=&quot;&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot;&gt;&lt;span style=&quot;font-size: 10px;&quot;&gt;&lt;b&gt;FEDORA MESSAGING&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 8px;&quot;&gt;PRODUCTION BUS&lt;/font&gt;&lt;/font&gt;" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;rounded=1;" vertex="1" parent="1">
<mxGeometry x="-390" y="390" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-42" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-36" target="qASsJMXoT1ADjvtwPi7K-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-43" value="&lt;font data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot; style=&quot;font-size: 8px;&quot;&gt;Information required for verification&lt;/font&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-42">
<mxGeometry x="-0.1362" y="1" relative="1" as="geometry">
<mxPoint x="1" y="-34" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-36" value="&lt;font style=&quot;font-size: 10px;&quot; data-font-src=&quot;https://fonts.googleapis.com/css?family=JetBrains+Mono&quot; face=&quot;JetBrains Mono&quot;&gt;&lt;b&gt;DATABASE&lt;/b&gt;&lt;/font&gt;" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;rounded=1;" vertex="1" parent="1">
<mxGeometry x="30" y="510" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-40" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="qASsJMXoT1ADjvtwPi7K-20" target="qASsJMXoT1ADjvtwPi7K-36">
<mxGeometry relative="1" as="geometry">
<mxPoint x="30" y="600" as="targetPoint" />
<Array as="points">
<mxPoint x="10" y="540" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="qASsJMXoT1ADjvtwPi7K-41" value="&lt;span style=&quot;font-family: &amp;quot;JetBrains Mono&amp;quot;; font-size: 8px;&quot;&gt;Entry to the MESSAGE table&lt;/span&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="qASsJMXoT1ADjvtwPi7K-40">
<mxGeometry x="-0.4573" y="1" relative="1" as="geometry">
<mxPoint x="-1" y="8" as="offset" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View file

@ -0,0 +1,56 @@
.. _apis:
Message producer
================
The following is an interaction diagram of the message producer.
.. image:: ../_static/w2fm_mpro.svg
:target: ../_images/w2fm_mpro.svg
Interactions detailed
---------------------
1. When an event invocation request is sent from the webhook service to the
API service, the validity of the request is verified using the information
available in the database by the API service.
a. If the validity is accepted, the following steps take place -
#. The event invocation request is forwarded to the message producer
where necessary templating is applied on the message topic and the
message body.
#. After the templating has been applied, the message is then shared
with the Fedora Messaging bus and the response from the production
bus is received.
#. An entry containing the datetime information of the message creation,
the digest signature of the message and associated service identifier
is stored.
#. A response containing the digest signature of the message and the
message identifier is then extended to the API service to be sent to
the requestor.
#. The API service sends a HTTP 200 response with body containing the
message identifier and the digest signature of the message to the
webhook service.
b. If the validity is rejected or if any error happens, the following steps take place -
#. If the service associated with the service UUID requested is not
found, an HTTP 400 response is shared by the API service with details
of the failure.
#. If the credentials of the user are provided incorrectly in the request
header, an HTTP 401 response is shared by the API service with details
of the failure.
#. If the requesting user is not allowed to invoke an event from the
service, an HTTP 403 response is shared by the API service with details
of the failure.
#. If the UUID associated with the conveyed message has been already been
used, an HTTP 409 response is shared by the API service with details
of the failure.
#. If an unexpected server-side error happens that cannot be recovered
from, an HTTP 500 response is shared by the API service with details
of the failure.
2. Depending on the response received by the webhook service, it can decide
to either continue making event invocation requests or debug the reasons
why the service is not working as intended.