Class: Karafka::Persistence::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/persistence/client.rb

Overview

Persistence layer to store current thread messages consumer client for further use

Class Method Summary collapse

Class Method Details

.readKarafka::Connection::Client

Returns persisted messages consumer client.

Returns:

Raises:



23
24
25
# File 'lib/karafka/persistence/client.rb', line 23

def read
  Thread.current[PERSISTENCE_SCOPE] || raise(Errors::MissingClientError)
end

.write(client) ⇒ Karafka::Connection::Client

Returns persisted messages consumer client.

Parameters:

Returns:



16
17
18
# File 'lib/karafka/persistence/client.rb', line 16

def write(client)
  Thread.current[PERSISTENCE_SCOPE] = client
end