Class: Karafka::CodeReloader
- Inherits:
-
Object
- Object
- Karafka::CodeReloader
- Defined in:
- lib/karafka/code_reloader.rb
Overview
Special type of a listener, that is not an instrumentation one, but one that triggers code reload in the development mode after each fetched batch (or message)
Please refer to the development code reload sections for details on the benefits and downsides of the in-process code reloading
Instance Method Summary collapse
-
#initialize(*reloaders, &block) ⇒ CodeReloader
constructor
A new instance of CodeReloader.
-
#on_connection_listener_fetch_loop(_event) ⇒ Object
Binds to the instrumentation events and triggers reload.
Constructor Details
#initialize(*reloaders, &block) ⇒ CodeReloader
Returns a new instance of CodeReloader.
21 22 23 24 |
# File 'lib/karafka/code_reloader.rb', line 21 def initialize(*reloaders, &block) @reloaders = reloaders @block = block end |
Instance Method Details
#on_connection_listener_fetch_loop(_event) ⇒ Object
Note:
Since we de-register all the user defined objects and redraw routes, it means that we won't be able to do a multi-batch buffering in the development mode as each of the batches will be buffered on a newly created “per fetch” instance.
Binds to the instrumentation events and triggers reload
31 32 33 |
# File 'lib/karafka/code_reloader.rb', line 31 def on_connection_listener_fetch_loop(_event) reload end |