Sha256: 886ba70ba0e7c862bc15e4bb24df122e08766ccd4d1b56383000ce11e0f47312

Contents?: true

Size: 704 Bytes

Versions: 8

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

namespace :rimless do
  desc 'Start the Apache Kafka consumer'
  task :consumer do
    system 'bundle exec karafka server'
  end

  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

8 entries across 8 versions & 1 rubygems

Version Path
rimless-1.2.0 lib/rimless/tasks/consumer.rake
rimless-1.1.1 lib/rimless/tasks/consumer.rake
rimless-1.1.0 lib/rimless/tasks/consumer.rake
rimless-1.0.4 lib/rimless/tasks/consumer.rake
rimless-1.0.3 lib/rimless/tasks/consumer.rake
rimless-1.0.2 lib/rimless/tasks/consumer.rake
rimless-1.0.1 lib/rimless/tasks/consumer.rake
rimless-1.0.0 lib/rimless/tasks/consumer.rake