Page 1 of 1

API Efficiency

PostPosted: Thu Feb 25, 2016 4:23 pm
by RafalNiewinski
Hello Kent,

I would like to ask you something about API Callbacks.
I am building infrastructure with lots of API calls to PM Server and lots of Events called back from PM Server to my endpoint.
I am a little bit worry about fail requests (like server 500 codes), can you tell me something about callbacks implementation.

Tell me whether the callbacks operates asynchronously or anyone waiting in the queue and they are sent one a once?

Re: API Efficiency

PostPosted: Thu Feb 25, 2016 4:36 pm
by Kent Briggs
Callbacks are added to a queue and then a dedicated thread simply runs in a loop, pulling the oldest one from the queue and makes the http call. It waits for a response from your web server before repeating the loop. The queue is currently set to hold up to 500 callback requests. Any overflows are ignored.

Re: API Efficiency

PostPosted: Thu Feb 25, 2016 4:47 pm
by RafalNiewinski
Ok, what is the timeout, how much time do I have to process information?

Re: API Efficiency

PostPosted: Thu Feb 25, 2016 7:59 pm
by Kent Briggs
RafalNiewinski wrote:Ok, what is the timeout, how much time do I have to process information?


I'm not setting a timeout value so it's using the default value for the component (Indy TIdHTTP). I'm not sure what that value is (can't find it in the docs) but I suspect it's at least a minute or two. If you're expecting to handle a large volume with some slow-executing code, you might want to just queue those up and return immediately and let a secondary process perform the actual work.