Sha256: 7be7ba6901b87c5e02d3226ecad20fe21e4c73cdee1289c030405c91a1172b06
Contents?: true
Size: 1.15 KB
Versions: 5
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module Karafka # Allows to start and stop Karafka as part of a different process module Embedded class << self # Starts Karafka without supervision and without ownership of signals in a background thread # so it won't interrupt other things running def start Thread.new do Thread.current.name = 'karafka.embedded' Karafka::Process.tags.add(:execution_mode, 'embedded') Karafka::Server.start end end # Stops Karafka upon any event # # @note This method is blocking because we want to wait until Karafka is stopped with final # process shutdown def stop # Stop needs to be blocking to wait for all the things to finalize Karafka::Server.stop end # Quiets Karafka upon any event # # @note This method is not blocking and will not wait for Karafka to fully quiet. # It will trigger the quiet procedure but won't wait. # # @note Please keep in mind you need to `#stop` to actually stop the server anyhow. def quiet Karafka::Server.quiet end end end end
Version data entries
5 entries across 5 versions & 1 rubygems