ruby - rabbitmq exchange never publishes to queue binding -
I'm trying to get a basic exchange => The line going on Rabbitmq.
- My local host is running rabbitmq
- The rabbitmq web dashboard is available on
http: // localhost: 15672 / < Li> I have a message source written in an exchange named "yomtvraps"
- I have a line called "yomtvraps"
- I have the binding exchange "yomtvraps"
I started my message emitter :
- Li> Show all exchanges This web page shows incoming messages at the rate of 80 / s
- The Exchange page shows a graph with incoming messages
http: // localhost: 15672 / # / exchange /% 2 0 messages are outgoing ("... no publications. .. ")
The queue does not receive anything :
- I'm never listening to any message receiver
- to queue page sho Incoming Message
draws http: // localhost: 15672 / # / Kyuuj /% 2F / Yontwraps
Do I even remember? I think there is nothing right between money and queue but what?
The problem is basically: the routing key was not set for both, and apparently Exchange and queue need that key.
From:
is required "made" NAME_OF_QUEUE = "yomtvraps" NAME_OF_EXCHANGE = "yomtvraps" conn = Bunny.new (: auto_recover = & gt; false) Conn.start ch = conn.create_channel q = ch.queue ("yomtvraps") "" \ tthere says "Already have a line named \" # {NAME_OF_QUEUE} \ "if conn.queue_exists? (NAME_OF_QUEUE) Tthere "if first conn.exchange_exists? (NAME_OF_EXCHANGE) exchange = ch.direct (NAME_OF_EXCHANGE, durable = & gt; true) exchange.publish (" Hello World! ",: Routing_key =" # {NAME_OF_EXCHANGE}} " & Gt; NAME_OF_QUEUE) "[x] 'Hello World!' 'Conn.close
receivers enter:
"bunny" NAME_OF_QUEUE = "required" yomtvraps "NAME_OF_EXCHANGE =" yomtvraps "conn = Bunny.new ( : Auto_recover = & gt; wrong) conn.start ch = conn.create_channel q = ch.queue (NAME_OF_QUEUE) exchange = ch.direct (NAME_OF_EXCHANGE ,: durable = & gt; true) # Logstash starts like this "[ Waiting for messages is waiting. Subscribe to exit CTRL + C "q.bind (exchange,: routing_key => NAME_OF_QUEUE) (put: block = & gt; true)., Property, body puts" [x] received # Body} "End rescue interrupt => Output (in two different terminals):
$ ruby send_exchange.rb Already a queue was named" yomtvraps "before From the same "yomtvraps" the exchange [x] sent Hello World! $ Ruby received_queue.rb [*] Waiting for the message. Get CTRL + C [x] to exit the press Micro world!
Comments
Post a Comment