Module: Karafka::Routing::Features::ActiveJob::Topic

Defined in:
lib/karafka/routing/features/active_job/topic.rb

Overview

Topic extensions to be able to check if given topic is ActiveJob topic

Instance Method Summary collapse

Instance Method Details

#active_job(active = false) ⇒ Object

Note:

Since this feature supports only one setting (active), we can use the old API

where the boolean would be an argument

Parameters:

  • active (Boolean) (defaults to: false)

    should this topic be considered one working with ActiveJob



13
14
15
# File 'lib/karafka/routing/features/active_job/topic.rb', line 13

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

#active_job?Boolean

Returns is this an ActiveJob topic.

Returns:

  • (Boolean)

    is this an ActiveJob topic



18
19
20
# File 'lib/karafka/routing/features/active_job/topic.rb', line 18

def active_job?
  active_job.active?
end

#to_hHash

Returns topic with all its native configuration options plus active job namespace settings.

Returns:

  • (Hash)

    topic with all its native configuration options plus active job namespace settings



24
25
26
27
28
# File 'lib/karafka/routing/features/active_job/topic.rb', line 24

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