Class: Karafka::Persistence::Client
- Inherits:
-
Object
- Object
- Karafka::Persistence::Client
- Defined in:
- lib/karafka/persistence/client.rb
Overview
Persistence layer to store current thread messages consumer client for further use
Constant Summary collapse
- PERSISTENCE_SCOPE =
Thread.current key under which we store current thread messages consumer client
:client
Class Method Summary collapse
-
.read ⇒ Karafka::Connection::Client
Persisted messages consumer client.
-
.write(client) ⇒ Karafka::Connection::Client
Persisted messages consumer client.
Class Method Details
.read ⇒ Karafka::Connection::Client
Returns persisted messages consumer client.
20 21 22 |
# File 'lib/karafka/persistence/client.rb', line 20 def self.read Thread.current[PERSISTENCE_SCOPE] || raise(Errors::MissingClient) end |
.write(client) ⇒ Karafka::Connection::Client
Returns persisted messages consumer client.
13 14 15 |
# File 'lib/karafka/persistence/client.rb', line 13 def self.write(client) Thread.current[PERSISTENCE_SCOPE] = client end |