Author Topic: Parallel Block in IRD strategy.  (Read 252 times)

Offline Maya

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Parallel Block in IRD strategy.
« on: November 23, 2018, 07:40:39 AM »
We need to make multiple backend requests to provide correct treatment in the IVR  to the caller based on caller profile.

We are not using composer/ORS...so still with IRD.

Anyone know how to implement parallel block in IRD similar to Composer parallel block.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 6759
  • Karma: 56332
Re: Parallel Block in IRD strategy.
« Reply #1 on: November 23, 2018, 11:30:31 AM »
Only way would be you to create a single point of request, and use it on ird. This point will trigger all your WS. There is no way to do such in IRD

Enviado de meu E6633 usando o Tapatalk


Offline vmc

  • Jr. Member
  • **
  • Posts: 93
  • Karma: 0
Re: Parallel Block in IRD strategy.
« Reply #2 on: November 23, 2018, 12:06:18 PM »
You would need your middleware layer to do this really. Would need to know more about why it has to be parallel really.

Sent from my Redmi Note 3 using Tapatalk


Offline Maya

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
Re: Parallel Block in IRD strategy.
« Reply #3 on: November 23, 2018, 12:28:31 PM »
Here is use case - Caller enters customer ID , PIN and other info.

Now, we need to make 4-5 different Web service calls to find different products and other details enrolled by the customer. Once all the 5 requests completed, based on the response of each request, we need to dynamically generate a menu based on different products and other applicable conditions.

In composer, I can use the Parallel block in SCXML to achieve same but How I can do same in IRD?

Offline vmc

  • Jr. Member
  • **
  • Posts: 93
  • Karma: 0
Re: Parallel Block in IRD strategy.
« Reply #4 on: November 23, 2018, 05:33:31 PM »
Still think that may be best done via a single Web request that your middleware compiles.  Although I'm still not sure why this has to be in parallel.

If there is a finite set of possible results you could just build that up into a list variable indexing each result.

Sent from my Redmi Note 3 using Tapatalk


Offline terry

  • Sr. Member
  • ****
  • Posts: 256
  • Karma: 32
Re: Parallel Block in IRD strategy.
« Reply #5 on: November 23, 2018, 05:55:17 PM »
Not sure why e aptly parallelism is required here.
What "main thread" going to do all this time?
Is it about making all 5 web requests at the same time?
Why not to do it sequntially?

But in any case, if it still needed, basically, there is function Fork which allows to start any number of parallel threads e ery one with it's own logic of any type. Only thing you cannot route from forked threads - all target objects need to be used in main thread (= strategy loaded on RP).

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 6759
  • Karma: 56332
Re: Parallel Block in IRD strategy.
« Reply #6 on: November 23, 2018, 07:42:21 PM »
He means that his problem is that each WS has for example 3 seconds return time, so he will have to wait 15 seconds for 5 WS sequential calls. But if he did call them in parallel would be just 3 as all are called at once.
Still don't see fork could do that, there is no single block to allow all 5 WS calls at once.

Enviado de meu E6633 usando o Tapatalk


Offline terry

  • Sr. Member
  • ****
  • Posts: 256
  • Karma: 32
Re: Parallel Block in IRD strategy.
« Reply #7 on: November 24, 2018, 04:52:49 AM »
Not a single block - all logic should be explicitly programmed function by function,. block by block.
Fork[strategy, extensions] - starts new thread for the same call/interaction (where provided strategy will run) but doesn't block - immediately continues.
If you write utility strategy(ies) that performs web request (and may be preprocesses result) you can call it(them) five times in a row - it will results 5 "threads" start every running the provided strategy and all in "parallel". It can be 5 different utility strategies (if web requests are very different) or the same strategy called with different parameters/extensions pointing to different web services. All these strategies running for the same call/interaction so they shares variables of scope INTERACTION. Passed parameters availble in forked strategy as extensions - ExtensionData[] function).

The only think may be - finding out from main strategy when all forked "threads" ended (I'm not aware about something like "join" function). Still some manual syncing logic can be implemented (like set counter before forking to 5, mentioned utility subroutines to decrease it by 1 at the end, after forking 5 threads wait until counter come to 0). Result of web requests to be stored in variable(s) of type INTERACTION so main strategy will have access to them every time.


 




Offline Raja Sekhar

  • Jr. Member
  • **
  • Posts: 56
  • Karma: -1
  • Genesys Routing Applciation developer
Re: Parallel Block in IRD strategy.
« Reply #8 on: November 28, 2018, 08:59:32 PM »
I would suggest, Have a Play announcement Block with HOLD MUSIC played and Place all the 5 web-service blocks following it.

Make sure, Wait for End treatment is unchecked in Play treatment Block.

In the above scenario, While Play treatment Block is executing bu URS, it starts executing all the following NON-Treatment blocks like Assign Block,Function Block,Web-service Block .until your next treatment Block is placed, customer will hear Initial HOLD Music.
So before Playing the Next treatment Block, Call the  function  ResetBusyTreatments[] in Function block, which will terminate the current announcement (HOLD MUSIC) and executed the next treatment.

Regards,
Raja
+91-9739983204
Rajasekhar YHS,
rajasekharlbit@gmail.com,
+919739983204