Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top