Module: Phobos::Test::Helper

Defined in:
lib/phobos/test/helper.rb

Defined Under Namespace

Classes: KafkaMessage

Instance Method Summary collapse

Instance Method Details

#process_message(handler:, payload:, metadata:, force_encoding: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/phobos/test/helper.rb', line 6

def process_message(handler:, payload:, metadata:, force_encoding: nil)
  listener = Phobos::Listener.new(
    handler: handler,
    group_id: 'test-group',
    topic: 'test-topic',
    force_encoding: force_encoding
  )

  Phobos::Actions::ProcessMessage.new(
    listener: listener,
    message: KafkaMessage.new(payload),
    metadata: ,
    encoding: listener.encoding
  ).execute
end