Module: Karafka::Pro::Routing::Features::ScheduledMessages::Topic

Defined in:
lib/karafka/pro/routing/features/scheduled_messages/topic.rb

Overview

Topic extensions to be able to check if given topic is a scheduled messages topic Please note, that this applies to both the schedules topic and logs topic

Instance Method Summary collapse

Instance Method Details

#scheduled_messages(active = false) ⇒ Object

Parameters:

  • active (Boolean) (defaults to: false)

    should this topic be considered related to scheduled messages



23
24
25
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 23

def scheduled_messages(active = false)
  @scheduled_messages ||= Config.new(active: active)
end

#scheduled_messages?Boolean

Returns is this an ActiveJob topic.

Returns:

  • (Boolean)

    is this an ActiveJob topic



28
29
30
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 28

def scheduled_messages?
  scheduled_messages.active?
end

#to_hHash

messages namespace settings

Returns:

  • (Hash)

    topic with all its native configuration options plus scheduled



34
35
36
37
38
# File 'lib/karafka/pro/routing/features/scheduled_messages/topic.rb', line 34

def to_h
  super.merge(
    scheduled_messages: scheduled_messages.to_h
  ).freeze
end