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
Changes from 2 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
4 changes: 4 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,9 @@ 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)

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