Sha256: f4d1840c403ab0b8758bfb21451155d3a7faf60bf0812778e82fe39123bfb9bd

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

require_relative "./common"

LOG.info("starting producer")

stopping = false

ending_proc = proc do
  stopping = true
end

trap "TERM", &ending_proc
trap "INT", &ending_proc

counter = 0

while !stopping do
  10.times do
    counter += 1
    begin
      MessageDriver::Client.publish(:basic_consumer_producer, "message #{counter}")
    rescue MessageDriver::ConnectionError => e
      LOG.info("The connection is closed! #{e}")
      sleep 1
      LOG.info("retrying...")
      retry
    end
  end
  LOG.info("sent 10 more messages for a total of #{counter}")
  sleep 1
end

LOG.info("stopping producer")
MessageDriver::Broker.stop

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
message-driver-0.3.0 examples/basic_producer_and_consumer/producer.rb
message-driver-0.2.2 examples/basic_producer_and_consumer/producer.rb
message-driver-0.2.1 examples/basic_producer_and_consumer/producer.rb
message-driver-0.2.0 examples/basic_producer_and_consumer/producer.rb
message-driver-0.2.0.rc2 examples/basic_producer_and_consumer/producer.rb
message-driver-0.2.0.rc1 examples/basic_producer_and_consumer/producer.rb