forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: chenxiaoxiong <chenxiaoxiong@huawei.com> Co-committed-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
33 lines
6.4 KiB
HTML
33 lines
6.4 KiB
HTML
<a name="dataartsstudio_01_0581"></a><a name="dataartsstudio_01_0581"></a>
|
|
|
|
<h1 class="topictitle1">Obtaining the Return Value of a Rest Client Node</h1>
|
|
<div id="body8662426"><p id="dataartsstudio_01_0581__en-us_topic_0000001116272948_p8060118">The Rest Client node can execute RESTful requests.</p>
|
|
<p id="dataartsstudio_01_0581__en-us_topic_0000001116272948_p123191531489">This tutorial describes how to obtain the return value of the Rest Client node, covering the following two application scenarios:</p>
|
|
<ul id="dataartsstudio_01_0581__en-us_topic_0000001116272948_ul910913617268"><li id="dataartsstudio_01_0581__en-us_topic_0000001116272948_li101091736132613"><a href="#dataartsstudio_01_0581__en-us_topic_0000001116272948_section16953144113278">Obtaining the Return Value Through Parameter "The response message body parses the transfer parameter"</a></li><li id="dataartsstudio_01_0581__en-us_topic_0000001116272948_li71091836182616"><a href="#dataartsstudio_01_0581__en-us_topic_0000001116272948_section1886792313411">Obtaining the Return Value Using an EL Expression</a></li></ul>
|
|
<div class="section" id="dataartsstudio_01_0581__en-us_topic_0000001116272948_section16953144113278"><a name="dataartsstudio_01_0581__en-us_topic_0000001116272948_section16953144113278"></a><a name="en-us_topic_0000001116272948_section16953144113278"></a><h4 class="sectiontitle">Obtaining the Return Value Through Parameter "The response message body parses the transfer parameter"</h4><p id="dataartsstudio_01_0581__en-us_topic_0000001116272948_p31811335191216">As shown in <a href="#dataartsstudio_01_0581__fig172611511282">Figure 1</a>, the first Rest Client node invokes the API of MRS to query the cluster list. <a href="#dataartsstudio_01_0581__en-us_topic_0000001116272948_fig082225015325">Figure 2</a> shows the JSON message body returned by the API.</p>
|
|
<ul id="dataartsstudio_01_0581__en-us_topic_0000001116272948_ul2087319176157"><li id="dataartsstudio_01_0581__en-us_topic_0000001116272948_li7873717121510">Scenario: The ID of the first cluster in the cluster list needs to be obtained and transferred to other nodes as a parameter.</li><li id="dataartsstudio_01_0581__en-us_topic_0000001116272948_li16873121731519">Key configurations: Set <strong id="dataartsstudio_01_0581__en-us_topic_0000001116272948_b3121832143218">The response message body parses the transfer parameter</strong> of the first Rest Client to <strong id="dataartsstudio_01_0581__en-us_topic_0000001116272948_b3234659203719">clusterId=clusters[0].clusterId</strong>. Other Rest Client nodes can reference the ID of the first cluster in ${clusterId} mode.<div class="note" id="dataartsstudio_01_0581__note12191331491"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dataartsstudio_01_0581__p152204314918">When setting <strong id="dataartsstudio_01_0581__b68473573473">The response message body parses the transfer parameter</strong>, ensure that the transferred parameter name (for example, <strong id="dataartsstudio_01_0581__b338553715481">clusterId</strong>) is unique among all node parameters of the job.</p>
|
|
</div></div>
|
|
</li></ul>
|
|
<div class="fignone" id="dataartsstudio_01_0581__fig172611511282"><a name="dataartsstudio_01_0581__fig172611511282"></a><a name="fig172611511282"></a><span class="figcap"><b>Figure 1 </b>Rest Client job example 1</span><br><span><img id="dataartsstudio_01_0581__image14968830337" src="en-us_image_0000002234241808.png" title="Click to enlarge" class="imgResize"></span></div>
|
|
<p id="dataartsstudio_01_0581__p114573010307"></p>
|
|
<div class="fignone" id="dataartsstudio_01_0581__en-us_topic_0000001116272948_fig082225015325"><a name="dataartsstudio_01_0581__en-us_topic_0000001116272948_fig082225015325"></a><a name="en-us_topic_0000001116272948_fig082225015325"></a><span class="figcap"><b>Figure 2 </b>JSON message body</span><br><span><img id="dataartsstudio_01_0581__image1536213341010" src="en-us_image_0000002234241796.png" title="Click to enlarge" class="imgResize"></span></div>
|
|
</div>
|
|
<div class="section" id="dataartsstudio_01_0581__en-us_topic_0000001116272948_section1886792313411"><a name="dataartsstudio_01_0581__en-us_topic_0000001116272948_section1886792313411"></a><a name="en-us_topic_0000001116272948_section1886792313411"></a><h4 class="sectiontitle">Obtaining the Return Value Using an EL Expression</h4><p id="dataartsstudio_01_0581__en-us_topic_0000001116272948_p163576216509">The Rest Client node can be used together with EL expressions. You can select different EL expressions based on scenarios. This section describes how to develop your own jobs based on your service requirements. </p>
|
|
<p id="dataartsstudio_01_0581__en-us_topic_0000001116272948_p16200165610153">As shown in <a href="#dataartsstudio_01_0581__en-us_topic_0000001116272948_fig474512269340">Figure 3</a>, the Rest Client invokes the API of MRS to query the cluster list and then invokes the Kafka Client to send a message.</p>
|
|
<ul id="dataartsstudio_01_0581__en-us_topic_0000001116272948_ul17425115181617"><li id="dataartsstudio_01_0581__en-us_topic_0000001116272948_li5425131516167">Scenario: The Kafka Client sends a character string message. The message content is the ID of the first cluster in the cluster list.</li><li id="dataartsstudio_01_0581__en-us_topic_0000001116272948_li94257155160">Key configurations: When you configure the Kafka Client, use the following EL expression to obtain a specific field in the message body returned by the REST API: <strong id="dataartsstudio_01_0581__en-us_topic_0000001116272948_b131241558194613">#{JSONUtil.toString(JSONUtil.path(Job.getNodeOutput("Rest_Client_4901"),"clusters[0].clusterId"))}</strong></li></ul>
|
|
<div class="fignone" id="dataartsstudio_01_0581__en-us_topic_0000001116272948_fig474512269340"><a name="dataartsstudio_01_0581__en-us_topic_0000001116272948_fig474512269340"></a><a name="en-us_topic_0000001116272948_fig474512269340"></a><span class="figcap"><b>Figure 3 </b>Rest Client job example 2</span><br><span><img id="dataartsstudio_01_0581__en-us_topic_0000001116272948_image1630913386107" src="en-us_image_0000002269201253.png" title="Click to enlarge" class="imgResize"></span></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dataartsstudio_01_0520.html">Usage Guidance</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
initImageViewer('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |