Question

Currently I am using GPars Agent class to process typical shopping cart scenario. I have a situation where I need to wait for addtocart, minicart tasks to complete before viewcart task returns response. The webservice call returns viewcart before returning addtocart/minicart. How do I let Agent class know to process the viewcart after other tasks are completed?

Was it helpful?

Solution

Agents always process submitted tasks sequentially. So if you submit the viewcart task last, it will be processed last. You may call agent.await() of agent.val to block the caller until all so-far-submitted tasks have been completed.

OTHER TIPS

Vaclav Pech,

Thank you much. Appreciate your help. I have handled this scenario adding a counter before(increment counter) and after(decrement counter) the service and waiting for the items to be processed in the View cart and redirect them to viewcart page. Just wanted to add my answer to this thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top