<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ABAP: Parallelize cl_http_client in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707257#M2018790</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;for asynchronous programming, you should check this resource:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codezentrale.de/tag/wait-for-asynchronous-tasks-until/" target="test_blank"&gt;https://codezentrale.de/tag/wait-for-asynchronous-tasks-until/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 16:28:28 GMT</pubDate>
    <dc:creator>ThorstenHoefer</dc:creator>
    <dc:date>2023-02-07T16:28:28Z</dc:date>
    <item>
      <title>ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707251#M2018784</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;Is it possible in ABAP - &lt;STRONG&gt;without work process parallelization &lt;/STRONG&gt;- to parallelize multiple external HTTP requests?&lt;/P&gt;
  &lt;P&gt;Example (what I would expect to work):&lt;/P&gt;
  &lt;UL&gt; 
   &lt;LI&gt;Instantiate 10 HTTP Requests (cl_http_request)&lt;/LI&gt; 
   &lt;LI&gt;Call "send" 10 times --&amp;gt; All 10 requests are processed by the external system&lt;/LI&gt; 
   &lt;LI&gt;Call Receive on the first Request --&amp;gt; Synchronously blocks the processing until first request is done&lt;/LI&gt; 
   &lt;LI&gt;Call Receive on the second Request --&amp;gt; Assumption, all requests are procesed identically fast, the second/third (etc..) Request should have already received the data --&amp;gt; no waiting&lt;/LI&gt; 
  &lt;/UL&gt;
  &lt;P&gt;Implementing this code naivly with cl_http_client is not working. The second, third, fourth (...) receive call is taking the same time like the first call.&lt;/P&gt;
  &lt;UL&gt; 
  &lt;/UL&gt;
  &lt;P&gt;Example Code how sth. like that would look like in JS / TS:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;const prom1 = axios.get("....");
const prom2 = axios.get("....");

const [answer1, answer2] = Promise.all([prom1, prom2]);&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I can not really believe nth. for this is existing in ABAP, as this seems to be a very simple requirement.. Instantiating workers (i.E. using function modules) is a massive overhead for such a simple task. I want to avoid that, as it causes a drain of worker-processes, which i need for other activities (i.E. users).&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Timo&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 09:28:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707251#M2018784</guid>
      <dc:creator>TimoStark</dc:creator>
      <dc:date>2023-02-04T09:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707252#M2018785</link>
      <description>&lt;P&gt;It has always been more complex in ABAP (because ABAP is verbose). You can create your own generic parallelization framework and share with the community. That would be helpful.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 10:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707252#M2018785</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-02-04T10:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707253#M2018786</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; Thanks for your response. Maybe I wasn't clear enough or I misunderstand your answer.&lt;/P&gt;&lt;P&gt;I know that I can easily parallelize via ABAP work processes. The point is: I want to parallelize in the HTTP clients - not the full blown ABAP work processes (which would be a big overhead).&lt;/P&gt;&lt;P&gt;I would like to achieve multiple active HTTP requests for the same ABAP work process. &lt;/P&gt;&lt;P&gt;Background: I have a scalable REST service (not under my control) which provides me one information for one plant. I need to call it for 10 different plants.&lt;/P&gt;&lt;P&gt;Possibility 1: make 10 sequential calls (bah...)&lt;/P&gt;&lt;P&gt;Possibility 2: use abap parallelization (not good, as it blocks work processes.. It is highly possile that 20 users are executing the same code at the same time)&lt;/P&gt;&lt;P&gt;Possibility 3: use http (icm) paralleization - normal approach for any other runtime stack (browser / nodejs / java / ... ) I am aware of.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 15:35:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707253#M2018786</guid>
      <dc:creator>TimoStark</dc:creator>
      <dc:date>2023-02-04T15:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707254#M2018787</link>
      <description>&lt;P&gt;I always saw CL_HTTP_CLIENT as being a synchronous call, and never saw the possibility of asynchronous call. I wonder if the &lt;A href="https://blogs.sap.com/2013/07/18/abap-news-for-release-740-abap-channels/"&gt;ABAP Channels&lt;/A&gt; would be the answer you are looking for. I never used them. I'm curious to see what other people can propose. Let's see.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 16:10:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707254#M2018787</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-02-04T16:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707255#M2018788</link>
      <description>&lt;P&gt;You could either use &lt;A href="https://github.com/xinitrc86/zthread"&gt;ZTHREAD&lt;/A&gt; or have a look how it is implemented:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data(myThread) = new zcl_thread(aRunnable).
new zcl_thread(anotherRunnable)-&amp;gt;start( ).
new zcl_thread(yetAnotherRunnable)-&amp;gt;start( ).

myThread-&amp;gt;start( ).
myThread-&amp;gt;join( ). "waits for this specific thread" 

zcl_thread=&amp;gt;join_all( ). "waits for all threads to finish" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Feb 2023 17:18:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707255#M2018788</guid>
      <dc:creator>Marian_Zeis</dc:creator>
      <dc:date>2023-02-04T17:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707256#M2018789</link>
      <description>&lt;P&gt;Hi Marian, &lt;/P&gt;&lt;P&gt;Thanks for your response (and also the very nice thread impl.). After a quick check in github it is though still using starting new task (and therefore using a worker process). &lt;/P&gt;&lt;P&gt;I do not want work processes as these are a very limited resource.. &lt;/P&gt;&lt;P&gt;Basically I would expect that the *send* command is sending (but not waiting) and the receive is waiting (compare it to await) - so the parallization is actually happening on the http receiver side.. On abap side there is just another open http request.. &lt;/P&gt;&lt;P&gt;This way with an Extremely scalable micro service I could call the rest endpoint I.e. 1000 times at the same time.. Without wasting actual processes on sap side. &lt;/P&gt;&lt;P&gt;When you are fit with Javascript : nobody would do two service workers (=threads) to implement two parallel http requests. Or in Java Nobody would make two http requests. &lt;/P&gt;&lt;P&gt;Instead the http request itself is async.. &lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 20:52:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707256#M2018789</guid>
      <dc:creator>TimoStark</dc:creator>
      <dc:date>2023-02-04T20:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707257#M2018790</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;for asynchronous programming, you should check this resource:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codezentrale.de/tag/wait-for-asynchronous-tasks-until/" target="test_blank"&gt;https://codezentrale.de/tag/wait-for-asynchronous-tasks-until/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 16:28:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707257#M2018790</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2023-02-07T16:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707258#M2018791</link>
      <description>&lt;P&gt;Answered myself here &lt;A href="https://blogs.sap.com/2023/02/17/parallelize-cl_http_client/" target="test_blank"&gt;https://blogs.sap.com/2023/02/17/parallelize-cl_http_client/&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 13:54:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707258#M2018791</guid>
      <dc:creator>TimoStark</dc:creator>
      <dc:date>2023-02-17T13:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP: Parallelize cl_http_client</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707259#M2018792</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;8ae6723ab3fa43a8980099fe48f90b04&lt;/SPAN&gt; you can accept your own answer&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 14:05:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-parallelize-cl-http-client/m-p/12707259#M2018792</guid>
      <dc:creator>Marian_Zeis</dc:creator>
      <dc:date>2023-02-17T14:05:28Z</dc:date>
    </item>
  </channel>
</rss>

