Sha256: 90f9d87f0cfe700dcd9b2b3de2128afeed1638687b418002d36bc402fd46e323

Contents?: true

Size: 867 Bytes

Versions: 10

Compression:

Stored size: 867 Bytes

Contents

# frozen_string_literal: true

namespace :rimless do
  # rubocop:disable Rails/RakeEnvironment because this is just an command
  #   proxy, no need for an application bootstrap
  desc 'Start the Apache Kafka consumer'
  task :consumer do
    system 'bundle exec karafka server'
  end
  # rubocop:enable Rails/RakeEnvironment

  desc 'Print all the consumer routes'
  task routes: :environment do
    require 'rimless'

    Rimless.consumer.consumer_groups.each do |consumer_group|
      consumer_group.topics.each do |topic|
        name = topic.name.split('.')[1..].join('.')

        puts "#    Topic: #{name}"
        puts "# Consumer: #{topic.consumer}"

        base = topic.consumer.superclass.new(topic).methods
        events = topic.consumer.new(topic).methods - base

        puts "#   Events: #{events.join(', ')}"
        puts
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rimless-1.8.0 lib/rimless/tasks/consumer.rake
rimless-1.7.7 lib/rimless/tasks/consumer.rake
rimless-1.7.6 lib/rimless/tasks/consumer.rake
rimless-1.7.5 lib/rimless/tasks/consumer.rake
rimless-1.7.4 lib/rimless/tasks/consumer.rake
rimless-1.7.3 lib/rimless/tasks/consumer.rake
rimless-1.7.2 lib/rimless/tasks/consumer.rake
rimless-1.7.1 lib/rimless/tasks/consumer.rake
rimless-1.7.0 lib/rimless/tasks/consumer.rake
rimless-1.6.0 lib/rimless/tasks/consumer.rake