Sha256: c74351ecf51f3bb86fcc02343ff6cf449fd21d87f7eeb64d8ca4eb4e365e6f64

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'logger'
require 'jstreams'

STDOUT.sync = true

USAGE = 'usage: ruby subscriber.rb [subscriber_key]'

subscriber_key = ARGV[0] || abort(USAGE)

puts "Starting subscriber #{subscriber_key}..."

logger = Logger.new(STDOUT)
jstreams = Jstreams::Context.new(logger: logger)

jstreams.subscribe(
  'mysubscriber',
  'mystream',
  key: subscriber_key
) { |message| logger.info "Subscriber got a message: #{message.inspect}" }

jstreams.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jstreams-0.1.0.alpha examples/basic/example_subscriber.rb