Sha256: b5ad34f152ea7e9eedaf38adfcf9c647fdec5ec7c4ace198850f659b4d6d6911

Contents?: true

Size: 683 Bytes

Versions: 2

Compression:

Stored size: 683 Bytes

Contents

require "bundler/setup"
require "glass_octopus"

app = GlassOctopus.build do
  use GlassOctopus::Middleware::CommonLogger

  run Proc.new { |ctx|
    puts "Got message: #{ctx.message.key} => #{ctx.message.value}"
  }
end

def array_from_env(key, default:)
  return default unless ENV.key?(key)
  ENV.fetch(key).split(",").map(&:strip)
end

GlassOctopus.run(app) do |config|
  config.adapter :ruby_kafka do |kafka|
    kafka.broker_list = array_from_env("KAFKA_BROKER_LIST", default: %w[localhost:9092])
    kafka.topic       = ENV.fetch("KAFKA_TOPIC", "mytopic")
    kafka.group       = ENV.fetch("KAFKA_GROUP", "mygroup")
    kafka.client      = { logger: config.logger }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glass_octopus-1.1.0 example/ruby_kafka.rb
glass_octopus-1.0.0 example/ruby_kafka.rb