Help Needed: How to Ensure BPL ????? for All Asynchronous Calls Before Proceeding?͓̽
Hello,
First of all: thanks for your help, and thank you for your time.
Thanks for your time.
We have the following situation:
We are in a BPL, and we have defined 4 <call> asynchronous as follows:
First one name: "Enviar a Proceso NEGRIN"
The second one, named as: "Enviar a Proceso HUNSC"
The third one, titled: "Enviar a Proceso CHUIMI 02"
And the fourth and last one names as: "Enviar a Proceso Fuertev"
Inmediately after the 4 calls, we have a <sync> instruction which should wait for all of them to finish.
It has in the calls text area the name of the four ones which it should wait for: "Enviar a Proceso NEGRIN,Enviar a Proceso HUNSC,Enviar a Proceso CHUIMI 02,Enviar a Proceso Fuertev"
If we zoom out the BPL, we see it spots in green the 4 previous calls:
However, when we test it, we see in the Visual Trace the following behaviour:
We would like that the Process would wait for [12], [15], [17] and [19]... but it does not wait... it just get the first <call> response as seen in [12] and it executes the following <code> block which obviously fails...
Finally, we have the following doubt:
How could we say to the BPL to wait always for the 4 <call> response before executing the next <code> block?
We have read the following documentation to solve it by ourselves:
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
https://es.community.intersystems.com/post/call-as%C3%ADncronicas-din%C3...
Sync is your friend! Declare it after calls and configure it to wait for the answers.
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
Thank you for your answer @Luis Angel Pérez Ramos
However, as I detailed in the first post the <sync> command does not do what it is supposed that it does.
We have used it as follows:
<sync name='Esperar respuestas' calls='Enviar a Proceso NEGRIN,Enviar a Proceso HUNSC,Enviar a Proceso CHUIMI 02,Enviar a Proceso Fuertev' timeout='"PT30S"' type='all' xpos='200' ypos='2550' />
But it does not stop the BPL execution until all the 4 calls finish with a repsonse... it just waits until the first call gives a response, and then it continues.
Could you help us, please?
Thank you.
Try to put together all the calls followed by the sync, all of them inside the scope and at the end, after the sync, the catchall.
Thank you @Luis Angel Pérez Ramos , for your time and help.
We have put together all the calls followed by the sync, all of them inside the scope and at the end, after the sync, the catchall, as follows:
Being the scope as follows:
<scope xpos='200' ypos='450' xend='200' yend='1500' > <call name='Enviar a Proceso NEGRIN' target='Radiologia.CConcertadosOrdenesNEGRIN' async='1' xpos='200' ypos='650' > <request type='Mensajes.Request.Radiologia.CConcertados.BusquedaOrdenesNEGRINRequest' > <assign property="callrequest" value="request" action="set" /> </request> <response type='Mensajes.Response.CConcertadostoPACS.Radiologia.BusquedaOrdenesNEGRINResponse' > <assign property="context.busquedaOrdenesNEGRINResponse" value="callresponse" action="set" /> </response> </call> <call name='Enviar a Proceso HUNSC' target='Radiologia.CConcertadosOrdenesHUNSC' async='1' xpos='200' ypos='850' > <request type='Mensajes.Request.Radiologia.CConcertados.BusquedaOrdenesRequest' > <assign property="callrequest" value="request" action="set" /> </request> <response type='Mensajes.Response.Radiologia.CConcertados.BusquedaOrdenesResponse' > <assign property="context.listaBusquedaOrdenes.PacientesDerivadosCC" value="callresponse" action="insert" key="1" /> </response> </call> <call name='Enviar a Proceso CHUIMI 02' target='Radiologia.CConcertadosOrdenesCHUIMI' async='1' xpos='200' ypos='1050' > <request type='Mensajes.Request.Radiologia.CConcertados.BusquedaOrdenesRequest' > <assign property="callrequest" value="request" action="set" /> </request> <response type='Mensajes.Response.Radiologia.CConcertados.BusquedaOrdenesResponse' > <assign property="context.listaBusquedaOrdenes.PacientesDerivadosCC" value="callresponse" action="insert" key="2" /> </response> </call> <call name='Enviar a Proceso Fuertev' target='Radiologia.CConcertadosOrdenesFUERTEV' async='1' xpos='200' ypos='1150' > <request type='Mensajes.Request.Radiologia.CConcertados.BusquedaOrdenesRequest' > <assign property="callrequest" value="request" action="set" /> </request> <response type='Mensajes.Response.Radiologia.CConcertados.BusquedaOrdenesResponse' > <assign property="context.listaBusquedaOrdenes.PacientesDerivadosCC" value="callresponse" action="insert" key="2" /> </response> </call> <sync name='Esperar respuestas' calls='Enviar a Proceso NEGRIN,Enviar a Proceso HUNSC,Enviar a Proceso CHUIMI 02,Enviar a Proceso Fuertev' timeout='"PT30S"' type='all' xpos='200' ypos='1250' /> <faulthandlers> <catchall xpos='200' ypos='1350' xend='200' yend='250' /> </faulthandlers> </scope>
However, when we test it, we observe the following Visual Trace:
The BPL should wait to receive [12], [15], [17] and [19] before continuing executing the code below the <sync>... but it does not wait for the 4 replies... it just wait for one of them..png)
The <sync> is configured to wait for all the fours <call>
"Enviar a Proceso NEGRIN,Enviar a Proceso HUNSC,Enviar a Proceso CHUIMI 02,Enviar a Proceso Fuertev"
But it does not wait for all them.
Why?
How could we solve it?
Thanks for your help and time.
All I can think of is the timeout setting. The documentation says it should be in seconds, i.e. an integer, but you have "PT30S" which might be treated as zero?
Thanks @Mike.W for your reply and help.
We have written the timeout as 30 and as "30" and in both cases it behaves wrong. It justs receives the first <call> response and it continues the BPL execution flow, without waiting for the other 3 replies:
Being the setting as "30":
And behaves similar with a timeout of 30:
30:
We do not know why.
Thanks for your help.
Try removing the Tiempo de espera and... Could you show the popup when you click on the magnifying glass of Llamadas? Just to be sure that it had correctly detected the calls.
Thank you @Luis Angel Pérez Ramos for your reply, let's see:
When we click on the magnyfying glass of Llamadas:
We see all the 4 <call> checked.
We have removed the timeout:
And it behaves like this:
It does not wait, for the 4 calls ^
Could you help us?
The documentation examples all have <sequence> blocks around the calls and sync. Your code only has a <scope> block in the bit we can see. Maybe try adding a <sequence>... </sequence>?
Actually, thinking about it, the behaviour is as if you had in the sync an attribute:
type='any'
but I can see you have:
type='all'
Maybe try changing the "type"? or removing it completely, as the default is "all"?