Jump to content
Sign in to follow this  
Jacek Laskowski

Delphi REST library and parallel requests

Recommended Posts

Does the REST library built into delphi allow multiple requests to run in parallel on a single TRESTClient?

The way you use this library is that you create an instance of TRESTClient:

 

      fClient := TRESTClient.Create(aBaseURL);

 

And then at runtime when there is a need to execute a request you create TRESTRequest, TRESTResponse and call Execute() on TRESTRequest, in short:

 

 fRequest := TRESTRequest.Create(nil);
 fRequest.Client := fClient;
 fRequest.Resource := aEndpointData.Endpoint;
 fRequest.Method := aEndpointData.HTTPMethod;
 fResponse := TRESTResponse.Create(nil);
 fRequest.Response := fResponse;
 fRequest.Execute();

That is, each request has a new TRESTRequest and a new TRESTResponse, but the same TRESTClient.

 

So is it allowed to execute simultaneously (e.g. in a thread) several requests on the same TRESTClient?

 

Share this post


Link to post
3 hours ago, Jacek Laskowski said:

Does the REST library built into delphi allow multiple requests to run in parallel on a single TRESTClient?

No. You need separate client for each request if you want to run them in parallel.

  • Thanks 1

Share this post


Link to post
10 hours ago, Dalija Prasnikar said:

No. You need separate client for each request if you want to run them in parallel.

It's a bit sad. Too bad.
Thanks.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×