Class: LogStash::Filters::FixProtocol
- Inherits:
-
Base
- Object
- Base
- LogStash::Filters::FixProtocol
- Defined in:
- lib/logstash/filters/fix_protocol.rb
Instance Attribute Summary collapse
-
#data_dictionary ⇒ Object
readonly
Returns the value of attribute data_dictionary.
-
#session_dictionary ⇒ Object
readonly
Returns the value of attribute session_dictionary.
Instance Method Summary collapse
- #filter(event) ⇒ Object
-
#initialize(options = {}) ⇒ FixProtocol
constructor
A new instance of FixProtocol.
- #register ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ FixProtocol
Returns a new instance of FixProtocol.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/logstash/filters/fix_protocol.rb', line 23 def initialize( = {}) super() fail "Need to configure a valid data dictionary path" unless config["data_dictionary_path"] @data_dictionary = DataDictionary.new(config["data_dictionary_path"]) # Set session data dictionary variable if using > FIX 5.0 session_dict = config["session_dictionary_path"] @session_dictionary = session_dict.present? ? DataDictionary.new(session_dict) : @data_dictionary end |
Instance Attribute Details
#data_dictionary ⇒ Object (readonly)
Returns the value of attribute data_dictionary.
14 15 16 |
# File 'lib/logstash/filters/fix_protocol.rb', line 14 def data_dictionary @data_dictionary end |
#session_dictionary ⇒ Object (readonly)
Returns the value of attribute session_dictionary.
14 15 16 |
# File 'lib/logstash/filters/fix_protocol.rb', line 14 def session_dictionary @session_dictionary end |
Instance Method Details
#filter(event) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/logstash/filters/fix_protocol.rb', line 39 def filter(event) = event[config["fix_message"]] if = nil begin = FixMessage.new(, data_dictionary, session_dictionary) rescue Java::Quickfix::InvalidMessage, ArgumentError event["tags"] = ["_fix_parse_failure"] end if fix_hash = .to_hash # TODO: Unknown tags are only set after calling #to_hash # this creates an implicit timing issue if .unknown_fields.any? event["unknown_fields"] = .unknown_fields event["tags"] = ["_fix_field_not_found"] end fix_hash.each do |key, value| event[key] = value end end end # filter_matched should go in the last line of our successful code filter_matched(event) end |
#register ⇒ Object
35 36 37 |
# File 'lib/logstash/filters/fix_protocol.rb', line 35 def register # just here because you complain otherwise end |