Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support long/infinite polling (streamed / chunked content) #101

Open
micoq opened this issue Sep 12, 2018 · 0 comments
Open

Support long/infinite polling (streamed / chunked content) #101

micoq opened this issue Sep 12, 2018 · 0 comments

Comments

@micoq
Copy link

micoq commented Sep 12, 2018

Some REST APIs provides streamed content: the HTTP client connects once and stay connected and the server pushes content to the client as it becomes available chunk per chunk.

Here is an example with Icinga: https://www.icinga.com/docs/icinga2/latest/doc/12-icinga2-api/#event-streams
This API will send the monitoring events as they occur.

Currently, the http_poller plugin will wait for the whole content and never returns an event object:

private
def handle_success(queue, name, request, response, execution_time)
  body = response.body # Wait for the whole content to be received
  [...] # Decode and create the event object
end

It could be nice to support this type of long polling. I know the manticore library could handle that like this for a single connection:

private
  def handle_success(queue, name, request, response, execution_time)
  response.body do |chunk|
      [...] # Decode and create the event object
  end
end

(however it's not enough since the loop will be blocked indefinitely and the other requests will never be triggered)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant