Class: LogStash::Util::WrappedAckedQueue::WriteClient

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/util/wrapped_acked_queue.rb

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ WriteClient

Returns a new instance of WriteClient.



342
343
344
# File 'lib/logstash/util/wrapped_acked_queue.rb', line 342

def initialize(queue)
  @queue = queue
end

Instance Method Details

#get_new_batchObject



346
347
348
# File 'lib/logstash/util/wrapped_acked_queue.rb', line 346

def get_new_batch
  WriteBatch.new
end

#push(event) ⇒ Object Also known as: <<



350
351
352
353
354
355
# File 'lib/logstash/util/wrapped_acked_queue.rb', line 350

def push(event)
  if @queue.closed?
    raise QueueClosedError.new("Attempted to write an event to a closed AckedQueue")
  end
  @queue.push(event)
end

#push_batch(batch) ⇒ Object



358
359
360
361
362
363
364
365
# File 'lib/logstash/util/wrapped_acked_queue.rb', line 358

def push_batch(batch)
  if @queue.closed?
    raise QueueClosedError.new("Attempted to write a batch to a closed AckedQueue")
  end
  batch.each do |event|
    push(event)
  end
end