calculateRoute vs. startCalculateRoute
Posted: Tue Jan 26, 2021 2:50 pm
Hi,
I just started evaluating xServer 2 API, my tests just calculate a simple route between point A and B.
I am using the provided C# client code.
I first used the slightly easier synchronous calculateRoute method, a single http request is used to get the response.
I then started using asynchronous startCalculateRoute, now at least three http requests are used to get the response, the first to create a new job, the second to watch the job and the third to fetch the response.
If I only have a single RouteRequest with a simple route between A and B, the synchronous single call seems faster.
I understand that if the request becomes more complicated and takes longer to process on the xServer side, it makes more sense to use startCalculateRoute.
Also if I have many RouteRequests which I can fire off in parallel, the asynchronous way should work better.
So my question is are there any best practices for when to use calculateRoute vs. startCalculateRoute.
I think in our case it would be helpful to have something like startCalculateBulkRoute where I can pass in many RouteRequests and still only used 3 http requests (+ some Watch calls) even if I have hundreds of requests.
I just started evaluating xServer 2 API, my tests just calculate a simple route between point A and B.
I am using the provided C# client code.
I first used the slightly easier synchronous calculateRoute method, a single http request is used to get the response.
I then started using asynchronous startCalculateRoute, now at least three http requests are used to get the response, the first to create a new job, the second to watch the job and the third to fetch the response.
If I only have a single RouteRequest with a simple route between A and B, the synchronous single call seems faster.
I understand that if the request becomes more complicated and takes longer to process on the xServer side, it makes more sense to use startCalculateRoute.
Also if I have many RouteRequests which I can fire off in parallel, the asynchronous way should work better.
So my question is are there any best practices for when to use calculateRoute vs. startCalculateRoute.
I think in our case it would be helpful to have something like startCalculateBulkRoute where I can pass in many RouteRequests and still only used 3 http requests (+ some Watch calls) even if I have hundreds of requests.