Module: Karafka::Embedded

Defined in:
lib/karafka/embedded.rb

Overview

Allows to start and stop Karafka as part of a different process

Class Method Summary collapse

Class Method Details

.quietObject

Note:

This method is not blocking and will not wait for Karafka to fully quiet.

Note:

Please keep in mind you need to ‘#stop` to actually stop the server anyhow.

Quiets Karafka upon any event

It will trigger the quiet procedure but won’t wait.



28
29
30
# File 'lib/karafka/embedded.rb', line 28

def quiet
  Karafka::Server.quiet
end

.startObject

Starts Karafka without supervision and without ownership of signals in a background thread so it won’t interrupt other things running



9
10
11
# File 'lib/karafka/embedded.rb', line 9

def start
  Thread.new { Karafka::Server.start }
end

.stopObject

Note:

This method is blocking because we want to wait until Karafka is stopped with final process shutdown

Stops Karafka upon any event



17
18
19
20
# File 'lib/karafka/embedded.rb', line 17

def stop
  # Stop needs to be blocking to wait for all the things to finalize
  Karafka::Server.stop
end