Class: Fluent::SQSOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::SQSOutput
- Includes:
- SetTagKeyMixin, SetTimeKeyMixin
- Defined in:
- lib/fluent/plugin/out_sqs.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Instance Method Details
#configure(conf) ⇒ Object
24 25 26 |
# File 'lib/fluent/plugin/out_sqs.rb', line 24 def configure(conf) super end |
#format(tag, time, record) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/fluent/plugin/out_sqs.rb', line 48 def format(tag, time, record) if @include_tag then record[@tag_property_name] = tag end record.to_msgpack end |
#shutdown ⇒ Object
44 45 46 |
# File 'lib/fluent/plugin/out_sqs.rb', line 44 def shutdown super end |
#start ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fluent/plugin/out_sqs.rb', line 28 def start super AWS.config( :access_key_id => @aws_key_id, :secret_access_key => @aws_sec_key) @sqs = AWS::SQS.new( :sqs_endpoint => @sqs_endpoint) if @create_queue then @queue = @sqs.queues.create(@queue_name) else @queue = @sqs.queues.named(@queue_name) end end |
#write(chunk) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/fluent/plugin/out_sqs.rb', line 56 def write(chunk) records = [] chunk.msgpack_each {|record| records << { :message_body => record.to_json, :delay_seconds => @delay_seconds } } until records.length <= 0 do @queue.batch_send(records.slice!(0..9)) end end |