0

In rabbitmq message from a named queue is displayed as ready and it is ackowledged by another queue which has topic exchange.

In the following image I have 2 different queues, one named one generated randomly by rabbtmq: enter image description here

I know that I send one message from the named queue (6.30189.facility_status) which has topic exchange and a specific routing key. In the consumer I create a queue without giving it a specific name, in the picture is the second queue (amq.gen-....). The consumer has a topic exchange and can get message from many queues.

How can I delete the messaged which is read from the named queue after I consume it in the second queue?

FaFa
  • 358
  • 2
  • 16
  • First of all, why are you trying to use an unnamed queue? – Julien Ambrosio Dec 13 '22 at 12:06
  • @JulienAmbrosio Now, I did by using named queues with direct exchange and was working, then I was told that I was doing it wrong and I supposed to consume from a queue whıch I don't know the name of, so I toght to change the exchange to topic and use unannamed queue. I should get the name from routing key, since I don't know the routing key, I ask how could I get it, I am told that I should get it from the rabbit mq connection. I guess there is no way for me to know. Or it really possible for me to get to know all the routing keys from a connection? – FaFa Dec 13 '22 at 12:15
  • @JulienAmbrosio how would you do it? I don't know, I don't even have anyone to ask. – FaFa Dec 13 '22 at 12:17
  • 1
    But why are you supposed to use an unnamed queue? Why do you don't focus in named queues, if are they working correctly? The unnamed queue have a few disadvantage such as, it's isn't durable and isn't fix name, so to manage the queue isn't easily. I don't understand why you need it. I will explain why it doesn't work as you expect in the answer but first I need to understand why you need to use unannamed queue. – Julien Ambrosio Dec 13 '22 at 12:19
  • Are you acknowledging the receipt of a message after you process the consumed event? – Julien Ambrosio Dec 13 '22 at 12:23
  • @JulienAmbrosio I'll explain you what I was told to do. I should create a publisher which sends some data in named queues and a consumer which waits to consume them. However the consumer does not know about the queue name. I don't need necessarily to create an unnamed queue but ı don't have other ways to know the existing queues. They told me to get the routing key from the rabbitmq connection object. But I don't know how to do that. I think it is impossible. And to me it does not make sense. – FaFa Dec 13 '22 at 12:30
  • 1
    Try to explain more why are you trying to do with these queues, for example: you have a buyer event and putting it into rabbit after the user buy something in the website. In the first queue you process the bought and pass the event to the second queue that is process the payment and etc. I think your problem is more related to your event driven architecture and it's taking you to these errors – Julien Ambrosio Dec 13 '22 at 12:31
  • @JulienAmbrosio I wrote noAck: false in channel consume function, I thought that acknowledged the message. – FaFa Dec 13 '22 at 12:31
  • 1
    No. The magic of rabbitmq is in acknowledged the event/message. So, basically when you put to false, you must ack the message manually. If you put it as true, you'll ack the message as auto in the final of the process of the single message and you don't control it. – Julien Ambrosio Dec 13 '22 at 12:35
  • @JulienAmbrosio I think so too, we need to send a message about if a facility(another program) is online or not every 2 minute. The facility send to exchange facility_status saygin that it is online. And the consumer see it saves it to the database and if in other 2 minute does not send another response, the database change its status to offline. – FaFa Dec 13 '22 at 12:35
  • @JulienAmbrosio about the noAck I misunderstood it before, thank you for explaining me, I understood the contrary before – FaFa Dec 13 '22 at 12:36
  • 1
    Now I understood your problem and I will try to create a complete answer in the next 2 hours. See you soon. – Julien Ambrosio Dec 13 '22 at 12:40
  • @JulienAmbrosio hi again you said that you could help me, I m just remind you in case you have forgotten – FaFa Dec 15 '22 at 05:50
  • sorry, I had a lot of troubles these days, I didn't have enough time to finish my answer yet – Julien Ambrosio Dec 15 '22 at 19:08
  • Do you need any help in this point yet? – Julien Ambrosio Dec 23 '22 at 13:29
  • @JulienAmbrosio Yes. I am actually getting the message from the named queue and I understood how the unacked column works, but now I don't know how to change the message from the ready column after I read the message in the unnamed column. – FaFa Dec 24 '22 at 17:34
  • Can you explain more why do you need unnamed queue. Why do you don't use named queue? – Julien Ambrosio Dec 27 '22 at 00:53
  • @JulienAmbrosio I changed it to a named queue which is all_facility_status. It gathers all info from other queues like this 6.30189.facility_status. However, even if it acknowledges the message from others queue, I still see the message in the ready column. How can I change the quantity in ready column after I read the message in another queue? – FaFa Dec 27 '22 at 10:45
  • Can you update your issue with these details to analyse again your problem? I think your trouble is little different now than they was before – Julien Ambrosio Dec 28 '22 at 15:26

0 Answers0