Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

prefetch support #64

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.0
0.13.0-3
5 changes: 5 additions & 0 deletions lib/fluent/plugin/in_amqp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AMQPInput < Input
config_param :exclusive, :bool, default: false
config_param :auto_delete, :bool, default: false
config_param :passive, :bool, default: false
config_param :prefetch, :integer, default: 0
config_param :payload_format, :string, default: "json"
config_param :tag_key, :bool, default: false
config_param :tag_header, :string, default: nil
Expand Down Expand Up @@ -70,6 +71,10 @@ def start
@connection.start
@channel = @connection.create_channel

if @prefetch > 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Style/NumericPredicate: Use @prefetch.positive? instead of @prefetch > 0.

@channel.prefetch(@prefetch)
end

if @exclusive && fluentd_worker_id > 0
log.info 'Config requested exclusive queue with multiple workers'
@queue += ".#{fluentd_worker_id}"
Expand Down