Class: Karafka::Pro::ScheduledMessages::Serializer

Inherits:
Object
  • Object
show all
Includes:
Core::Helpers::Time
Defined in:
lib/karafka/pro/scheduled_messages/serializer.rb

Overview

Note:

We only deal with states payload. Other payloads are not ours but end users.

Serializers used to build payloads (if applicable) for dispatch

Instance Method Summary collapse

Instance Method Details

#state(tracker) ⇒ String

Returns compressed payload with the state details.

Parameters:

  • tracker (Tracker)

    tracker based on which we build the state

Returns:

  • (String)

    compressed payload with the state details



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/karafka/pro/scheduled_messages/serializer.rb', line 24

def state(tracker)
  data = {
    schema_version: ScheduledMessages::STATES_SCHEMA_VERSION,
    dispatched_at: float_now,
    state: tracker.state,
    daily: tracker.daily
  }

  compress(
    serialize(data)
  )
end