jstotz/jstreams

View on GitHub
examples/basic/example_publisher.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require 'bundler/setup'
require 'jstreams'

STDOUT.sync = true
logger = Logger.new(STDOUT)

logger.info 'Starting publisher...'

jstreams = Jstreams::Context.new logger: logger

loop do
  body = "hello #{Time.now}"
  id = jstreams.publish('mystream', body)
  logger.info "published: #{id} - #{body}"
  sleep(1)
end