Sha256: 1377833f41b332f4fe95b651576d339be251495794d7f2aec7abd5c78316587a

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

# encoding: utf-8
require "fileutils"
require "logstash/event"
require "logstash/namespace"
require "logstash/util/wrapped_acked_queue"
require "logstash/util/wrapped_synchronous_queue"

module LogStash
  class QueueFactory
    def self.create(settings)
      queue_type = settings.get("queue.type")
      queue_page_capacity = settings.get("queue.page_capacity")
      queue_max_bytes = settings.get("queue.max_bytes")
      queue_max_events = settings.get("queue.max_events")
      checkpoint_max_acks = settings.get("queue.checkpoint.acks")
      checkpoint_max_writes = settings.get("queue.checkpoint.writes")
      checkpoint_max_interval = settings.get("queue.checkpoint.interval")

      queue_path = ::File.join(settings.get("path.queue"), settings.get("pipeline.id"))

      case queue_type
      when "persisted"
        # persisted is the disk based acked queue
        FileUtils.mkdir_p(queue_path)
        LogStash::Util::WrappedAckedQueue.create_file_based(queue_path, queue_page_capacity, queue_max_events, checkpoint_max_writes, checkpoint_max_acks, checkpoint_max_interval, queue_max_bytes)
      when "memory"
        # memory is the legacy and default setting
        LogStash::Util::WrappedSynchronousQueue.new
      else
        raise ConfigurationError, "Invalid setting `#{queue_type}` for `queue.type`, supported types are 'memory' and 'persisted'"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
logstash-core-5.6.16-java lib/logstash/queue_factory.rb
logstash-core-5.6.15-java lib/logstash/queue_factory.rb
logstash-core-5.6.14-java lib/logstash/queue_factory.rb
logstash-core-5.6.13-java lib/logstash/queue_factory.rb
logstash-core-5.6.12-java lib/logstash/queue_factory.rb
logstash-core-5.6.11-java lib/logstash/queue_factory.rb
logstash-core-5.6.10-java lib/logstash/queue_factory.rb