From e4a76286397c64d4d5605f636865d5f9f0ab4abc Mon Sep 17 00:00:00 2001 From: Daniel Popescu Date: Mon, 5 Jun 2017 13:39:15 -0700 Subject: [PATCH] Allow the SQS input plugin to shut down gracefully when no events have arrived in the queue. Fixes #33 --- lib/logstash/inputs/sqs.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/logstash/inputs/sqs.rb b/lib/logstash/inputs/sqs.rb index 302999e..d3d33e2 100644 --- a/lib/logstash/inputs/sqs.rb +++ b/lib/logstash/inputs/sqs.rb @@ -145,6 +145,10 @@ def handle_message(message) def run(output_queue) @logger.debug("Polling SQS queue", :polling_options => polling_options) + poller.before_request do |stats| + throw :stop_polling if stop? + end + run_with_backoff do poller.poll(polling_options) do |messages, stats| break if stop?