Sha256: d362e0a225a7dcf1466efa83b59b602fc8ca962ad2e3aa54f246f33306c1c1e5

Contents?: true

Size: 1.86 KB

Versions: 39

Compression:

Stored size: 1.86 KB

Contents

# encoding: utf-8

require "logstash/json"

# transient pipeline events for normal in-flow signaling as opposed to
# flow altering exceptions. for now having base classes is adequate and
# in the future it might be necessary to refactor using like a BaseEvent
# class to have a common interface for all pipeline events to support
# eventual queueing persistence for example, TBD.
module LogStash
  class SignalEvent
    def flush?; raise "abstract method"; end;
    def shutdown?; raise "abstract method"; end;
  end

  class ShutdownEvent < SignalEvent
    def flush?; false; end;
    def shutdown?; true; end;
  end

  class FlushEvent < SignalEvent
    def flush?; true; end;
    def shutdown?; false; end;
  end

  class NoSignal < SignalEvent
    def flush?; false; end;
    def shutdown?; false; end;
  end

  FLUSH = FlushEvent.new
  SHUTDOWN = ShutdownEvent.new
  NO_SIGNAL = NoSignal.new

  class Event
    MSG_BRACKETS_METHOD_MISSING = "Direct event field references (i.e. event['field']) have been disabled in favor of using event get and set methods (e.g. event.get('field')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
    MSG_BRACKETS_EQUALS_METHOD_MISSING = "Direct event field references (i.e. event['field'] = 'value') have been disabled in favor of using event get and set methods (e.g. event.set('field', 'value')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
    RE_BRACKETS_METHOD = /^\[\]$/.freeze
    RE_BRACKETS_EQUALS_METHOD = /^\[\]=$/.freeze

    def method_missing(method_name, *arguments, &block)
      if RE_BRACKETS_METHOD.match(method_name.to_s)
        raise NoMethodError.new(MSG_BRACKETS_METHOD_MISSING)
      end
      if RE_BRACKETS_EQUALS_METHOD.match(method_name.to_s)
        raise NoMethodError.new(MSG_BRACKETS_EQUALS_METHOD_MISSING)
      end
      super
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
logstash-core-6.8.23-java lib/logstash/event.rb
logstash-core-6.8.22-java lib/logstash/event.rb
logstash-core-6.8.21-java lib/logstash/event.rb
logstash-core-6.8.20-java lib/logstash/event.rb
logstash-core-6.8.19-java lib/logstash/event.rb
logstash-core-6.8.18-java lib/logstash/event.rb
logstash-core-6.8.17-java lib/logstash/event.rb
logstash-core-6.8.16-java lib/logstash/event.rb
logstash-core-6.8.15-java lib/logstash/event.rb
logstash-core-6.8.14-java lib/logstash/event.rb
logstash-core-6.8.13-java lib/logstash/event.rb
logstash-core-6.8.12-java lib/logstash/event.rb
logstash-core-6.8.11-java lib/logstash/event.rb
logstash-core-6.8.10-java lib/logstash/event.rb
logstash-core-6.8.9-java lib/logstash/event.rb
logstash-core-6.8.8-java lib/logstash/event.rb
logstash-core-6.8.7-java lib/logstash/event.rb
logstash-core-6.8.6-java lib/logstash/event.rb
logstash-core-6.8.5-java lib/logstash/event.rb
logstash-core-6.8.4-java lib/logstash/event.rb