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
-
.quiet ⇒ Object
Quiets Karafka upon any event.
-
.start ⇒ Object
Starts Karafka without supervision and without ownership of signals in a background thread so it won’t interrupt other things running.
-
.stop ⇒ Object
Stops Karafka upon any event.
Class Method Details
.quiet ⇒ Object
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.
33 34 35 |
# File 'lib/karafka/embedded.rb', line 33 def quiet Karafka::Server.quiet end |
.start ⇒ Object
Starts Karafka without supervision and without ownership of signals in a background thread so it won’t interrupt other things running
9 10 11 12 13 14 15 16 |
# File 'lib/karafka/embedded.rb', line 9 def start Thread.new do Thread.current.name = 'karafka.embedded' Karafka::Process..add(:execution_mode, 'embedded') Karafka::Server.start end end |
.stop ⇒ Object
Note:
This method is blocking because we want to wait until Karafka is stopped with final process shutdown
Stops Karafka upon any event
22 23 24 25 |
# File 'lib/karafka/embedded.rb', line 22 def stop # Stop needs to be blocking to wait for all the things to finalize Karafka::Server.stop end |