Sha256: 2c9bf51d4b214a160e411ccf80ee043d94849a3aa9a78ff3939d26cdb483ea53

Contents?: true

Size: 628 Bytes

Versions: 12

Compression:

Stored size: 628 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

until stopping
  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

12 entries across 12 versions & 1 rubygems

Version Path
message-driver-1.0.1 examples/basic_producer_and_consumer/producer.rb
message-driver-1.0.0 examples/basic_producer_and_consumer/producer.rb
message-driver-0.7.2 examples/basic_producer_and_consumer/producer.rb
message-driver-0.7.1 examples/basic_producer_and_consumer/producer.rb
message-driver-0.7.0 examples/basic_producer_and_consumer/producer.rb
message-driver-0.6.1 examples/basic_producer_and_consumer/producer.rb
message-driver-0.6.0 examples/basic_producer_and_consumer/producer.rb
message-driver-0.5.3 examples/basic_producer_and_consumer/producer.rb
message-driver-0.5.2 examples/basic_producer_and_consumer/producer.rb
message-driver-0.5.1 examples/basic_producer_and_consumer/producer.rb
message-driver-0.5.0 examples/basic_producer_and_consumer/producer.rb
message-driver-0.4.0 examples/basic_producer_and_consumer/producer.rb