Sha256: e5de681dfc093a4fc97a160343744aef60dc69c841600c7952bc3237e150844c

Contents?: true

Size: 869 Bytes

Versions: 6

Compression:

Stored size: 869 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..-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

6 entries across 6 versions & 1 rubygems

Version Path
rimless-1.5.1 lib/rimless/tasks/consumer.rake
rimless-1.5.0 lib/rimless/tasks/consumer.rake
rimless-1.4.2 lib/rimless/tasks/consumer.rake
rimless-1.4.1 lib/rimless/tasks/consumer.rake
rimless-1.4.0 lib/rimless/tasks/consumer.rake
rimless-1.3.0 lib/rimless/tasks/consumer.rake