I made a select API as an HTTP trigger which invokes the select orchestrator function.
The orch function makes a logistic search call & waits for the completion of any one task below:
- External event(occurs only once if a minimum of 3 on_search responses are received from the logistic on_search endpoint)
- Timer of 5 sec
The select orch func continues execution if any of the above tasks are completed and cancels/ignores the other task going forward.
If task 1 is completed within 5 sec then the logistic on_search HTTP endpoint will raise an external event with the best quote to select orch func.
If task 2 gets completed first then it will stop considering further logistic on_search responses.
Finally, the select orch func checks for the best on_search responses received so far. If there's any logistic on_search response available then the select orch func will make retail on_select response with delivery quote & delivery state serviceable else on_select response without delivery quote & delivery state non-serviceable.
Make Retail Select API Call
curl --location --request POST 'http://localhost:7287/api/Select'
Make Logistic OnSearch API Call
curl --location --request POST 'http://localhost:7287/api/OnSearch' \ --header 'Content-Type: application/json' \ --data-raw '{ "provider":"Dunzo", "price":20, "messageId":"720d4bd3-b998-4d3a-a817-b0e2487219fa", "transactionId":"c6931f3a-3674-4e49-9fe7-db70231c8276" }'