Hi,

I happened to me more than once that I have to create some REST service
"client" in which I usually wrap an HTTP client inside (ZnClient in this
case), and all the calls to the service, end up using the HTTP client,
inside some mutex to serialize the execution.

But I don't like that, in particular when some endpoints are better with
streaming responses (large downloads) and I have to fiddle with the client
and set it back to the settings before executing the request.

So, long story short... is it always safer to instantiate a new ZnClient on
a per request basis since no state is shared, but I guess it is also less
effective if I'm performing several requests to the same server.

What are the recommended approaches here?


Esteban A. Maringolo

Reply via email to