We have a JavaService task which makes a call to a third party WebService to get our order status. These services accept a list of orders. But we create a workflow instance for each order and so are currently calling the service for each order. As individual calls are expensive, we are asked to call WebService with a list.
And when do you know all orders of a list have been processed so you can invoke the web service with the list? If this logic is known, you could save each order in a table and only invoke the web service with all the stored orders when the condition is met.
There is no specific time so we do 5 tries(with 1 min gap) for each order for specific FINAL order states i.e. Delivered or Error and if neither of these states is received, then we mark order status programatically as failure.
We are thinking of using an external cron job which make a webservice call for a list of orders. As you suggested these orders would be persisted in custom table in Database and only a subset of them would be picked at a given point of time. Job then updates the table with order status. The timer for each workflow instance for an order periodically checks for order status in the DB on receiving a valid status moves to next step
Instead of a custom table for orders. Do you recommend leveraging User Task for wait state, with a system user assigned with tasks?