Class: Karafka::Web::Pro::Ui::Lib::Search::Matchers::RawPayloadIncludes

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/pro/ui/lib/search/matchers/raw_payload_includes.rb

Overview

Note:

It is case sensitive

Note:

Ignores encoding issues

Checks for phrase existence in the raw payload

Instance Method Summary collapse

Methods inherited from Base

active?, name

Instance Method Details

#call(message, phrase) ⇒ Boolean

Returns does message raw payload contain the phrase.

Parameters:

  • message (Karafka::Messages::Message)
  • phrase (String)

Returns:

  • (Boolean)

    does message raw payload contain the phrase



29
30
31
32
33
34
35
36
37
# File 'lib/karafka/web/pro/ui/lib/search/matchers/raw_payload_includes.rb', line 29

def call(message, phrase)
  # raw payload can be nil for tombstone events
  return false unless message.raw_payload

  message.raw_payload.include?(phrase)
# String matching on compressed data may fail
rescue Encoding::CompatibilityError
  false
end