Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #produser.rb
- require "hutch"
- Hutch.connect
- loop do
- print "Press return to send test message..."
- gets
- Hutch.publish("hutch.test", subject: "test message")
- puts "Send message with routing key 'hutch.test'"
- end
- #consumer.rb
- require "hutch"
- class TestConsumer
- include Hutch::Consumer
- consume "hutch"
- queue_name "hutch.test"
- def process(message)
- puts "TestConsumer got a message: #{message}"
- puts "Processing..."
- sleep(1)
- puts "Done"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement