forked from docs/doc-exports
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com> Co-authored-by: Chen, Junjie <chenjunjie@huawei.com> Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
53 lines
9.6 KiB
HTML
53 lines
9.6 KiB
HTML
<a name="functiongraph_01_0202"></a><a name="functiongraph_01_0202"></a>
|
|
|
|
<h1 class="topictitle1">Using an SMN Trigger</h1>
|
|
<div id="body32001227"><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p162261375529">This section describes how to create an SMN trigger and publish a message to trigger a function.</p>
|
|
<p id="functiongraph_01_0202__en-us_topic_0000001298547977_p152973114504">For details about the SMN event source, see section "Supported Event Sources".</p>
|
|
<div class="section" id="functiongraph_01_0202__en-us_topic_0000001298547977_section76949209512"><h4 class="sectiontitle">Prerequisites</h4><ul id="functiongraph_01_0202__en-us_topic_0000001298547977_ul5387217295227"><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li27709455101625">You have created an SMN topic, for example, <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b1980112154130">smn-test</strong>. For details, see <a href="https://docs.otc.t-systems.com/simple-message-notification/umn/topic_management/creating_a_topic.html#en-us-topic-0043961401" target="_blank" rel="noopener noreferrer">Creating a Topic</a>.</li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li1256318415313">You have created a function. For details, see <a href="functiongraph_01_0153.html#functiongraph_01_0153">Creating a Function from Scratch</a>.</li></ul>
|
|
</div>
|
|
<div class="section" id="functiongraph_01_0202__en-us_topic_0000001298547977_section1616723512526"><h4 class="sectiontitle">Creating an SMN Trigger</h4><ol id="functiongraph_01_0202__en-us_topic_0000001298547977_ol49388283105421"><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li188271311715"><span>Log in to the FunctionGraph console. In the navigation pane, choose <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001251907924_b033610517502">Functions</strong> > <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001251907924_b183361950502">Function List</strong>.</span></li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li488219139177"><span>Click the function to be configured to go to the function details page.</span></li><li id="functiongraph_01_0202__li48821313121717"><span>Choose <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001298507405_en-us_topic_0000001251588440_b289510228329">Configuration</strong> > <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001298507405_en-us_topic_0000001251588440_b156971032183216">Triggers</strong> and click <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001298507405_en-us_topic_0000001251588440_b98432283337">Create Trigger</strong>.</span><p><div class="fignone" id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001298507405_en-us_topic_0000001251588440_fig546212168431"><span class="figcap"><b>Figure 1 </b>Creating a trigger</span><br><span><img id="functiongraph_01_0202__en-us_topic_0000001298547977_en-us_topic_0000001298507405_en-us_topic_0000001251588440_image94621716114320" src="en-us_image_0000001679340817.png"></span></div>
|
|
</p></li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li38720938105421"><span>Set the following parameters:</span><p><ul id="functiongraph_01_0202__en-us_topic_0000001298547977_ul1162554453114"><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li967775412319"><strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b1801792369105424">Trigger Type</strong>: Select <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b1297167490105424">Simple Message Notification (SMN)</strong>.</li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li362513441313"><strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b298537260105424">Topic Name</strong>: Select a topic, for example, <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b2029652935105424">smn-test</strong>.</li></ul>
|
|
</p></li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li79961541103710"><span>Click <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b542457794105424">OK</strong>.</span><p><div class="note" id="functiongraph_01_0202__en-us_topic_0000001298547977_note95964273715"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p85934243713">After the SMN trigger is created, a subscription is generated for the corresponding topic on the SMN console.</p>
|
|
</div></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="functiongraph_01_0202__en-us_topic_0000001298547977_section720713914918"><h4 class="sectiontitle">Publishing a Message to Trigger the Function</h4><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p16450112912615">On the SMN console, publish a message to the <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b19113631161812">smn-test</strong> topic. For details, see <a href="https://docs.otc.t-systems.com/simple-message-notification/umn/topic_management/publishing_a_message/publishing_a_text_message.html#en-us-topic-0043961403" target="_blank" rel="noopener noreferrer">Publishing a Text Message</a>.</p>
|
|
<p id="functiongraph_01_0202__en-us_topic_0000001298547977_p1422514619438"><a href="#functiongraph_01_0202__en-us_topic_0000001298547977_table833644511032">Table 1</a> describes the parameters required for publishing a message.</p>
|
|
|
|
<div class="tablenoborder"><a name="functiongraph_01_0202__en-us_topic_0000001298547977_table833644511032"></a><a name="en-us_topic_0000001298547977_table833644511032"></a><table cellpadding="4" cellspacing="0" summary="" id="functiongraph_01_0202__en-us_topic_0000001298547977_table833644511032" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters required for publishing a message</caption><thead align="left"><tr id="functiongraph_01_0202__en-us_topic_0000001298547977_row289324011032"><th align="left" class="cellrowborder" valign="top" width="26.090000000000003%" id="mcps1.3.5.4.2.3.1.1"><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p3302586011032">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="73.91%" id="mcps1.3.5.4.2.3.1.2"><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p5784902911032">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="functiongraph_01_0202__en-us_topic_0000001298547977_row5525981111032"><td class="cellrowborder" valign="top" width="26.090000000000003%" headers="mcps1.3.5.4.2.3.1.1 "><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p4685971711032">Subject</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.91%" headers="mcps1.3.5.4.2.3.1.2 "><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p3754075611032">Enter <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b842352706162230">SMN-Test</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="functiongraph_01_0202__en-us_topic_0000001298547977_row232248711032"><td class="cellrowborder" valign="top" width="26.090000000000003%" headers="mcps1.3.5.4.2.3.1.1 "><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p5390379611032">Message Format</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.91%" headers="mcps1.3.5.4.2.3.1.2 "><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p3251789511642">Select <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b842352706182754">Text</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="functiongraph_01_0202__en-us_topic_0000001298547977_row2555605011032"><td class="cellrowborder" valign="top" width="26.090000000000003%" headers="mcps1.3.5.4.2.3.1.1 "><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p5677420111032">Message</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.91%" headers="mcps1.3.5.4.2.3.1.2 "><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p3530753111032">Enter <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b1544898403105424">{"message":"hello"}</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="note" id="functiongraph_01_0202__en-us_topic_0000001298547977_note116294717436"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="functiongraph_01_0202__en-us_topic_0000001298547977_p1363027104314">After a message is published, the function is triggered automatically. For details about example events, see section "Supported Event Sources".</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="functiongraph_01_0202__en-us_topic_0000001298547977_section16169183519527"><h4 class="sectiontitle">Viewing the Execution Result</h4><ol id="functiongraph_01_0202__en-us_topic_0000001298547977_ol46162701105021"><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li58761236951"><span>Return to the FunctionGraph console. In the navigation pane, choose <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b181826906691524">Functions</strong> > <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b213335919591524">Function List</strong>.</span></li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li154723022320"><span>Click a function to go to the function details page.</span></li><li id="functiongraph_01_0202__en-us_topic_0000001298547977_li2079912911238"><span>Choose <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b365672316395">Monitoring</strong> > <strong id="functiongraph_01_0202__en-us_topic_0000001298547977_b19656152373918">Logs</strong> to query function running logs.</span></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="functiongraph_01_0200.html">Creating Triggers</a></div>
|
|
</div>
|
|
</div>
|
|
|