How to assign queues to a worker in resque-pool using wildcard characters? - resque

I know '*':1 creates a worker to work on all queues and 'q1,q2':1 on queues q1 and q2, but is there a way to assign queues using something like queue_* instead of specifying the full name of queue? Thanks!

Related

Should I use Azure Topics over Queues?

I understand that Topics have the additional features of subscriptions and filters which Queues do not.
In which case, when would I absolutely need to use a queue over a topic?
For consistency, could I use a topics everywhere including as a replacement for queues?
A topic is not a replacement for a queue. The combination of a topic and a subscription is. A topic is allowing to “replicate” the same message to multiple subscriptions. A subscription what actually holds messages. A subscription is identical to a queue in its attributes and behaviour. You could replace a queue with a topic+subscription combo if you’d like, generating 2 entities per use case instead of a single queue. Just keep in mind there’s a finite number of entities per namespace.

How to read multiple queues messages from rabbitmq to logstash?

I have 3 different queues in rabbitmq where I have to read messages and send them to elasticsearch in the same index. I am confuse it is possible to read multiple queues in single config file. I am already reading one queue at a time. But I am getting realtime messages from different queues and need to process at the same time all these three queues?
you can, you need one input section for each queue

How to organize exchanges and queues in rabbitmq to use with async CQRS buses

I'm scaffolding my backend application and I want to use CQRS and rabbitmq with it (I'm pretty new to rabbitmq). For that, I have specified different vhosts for my prod and dev environments, but I'm not sure how to use exchanges and queues for command, events and query buses.
Should I use just one exchange, named for example CQRS and three different queues for commands, queries and events?
Or maybe should I use three different exchanges (named query_bus, command_bus and event_bus) and inside each one map one queue to every possible command query and event using routing keys?
Thanks!
You should have separate queues for different content (commands, queries...).
Because then its easier to see if the command or query side is lagging/slow by examining the length of each queue. The queue length gives you nice charts for your dashboard.

List jobs on specific queue in Laravel + RabbitMQ

I'm currently using Laravel 5.1 and RabbitMQ. My task requires that I list all the jobs in a specific queue, select at least one, and manipulate (purge/delete) it.
Is there a way to do it programmatically?
This is not possible, RabbitMQ allows you to get the first message from the queue and process it.
There is a way to get total messages count while calling declare a queue. But to me it looks suspicious

Getting a queue without providing its all properties

I am trying to write a consumer for an existing queue.
RabbbitMQ is running in a separate instance and queue named "org-queue" is already created and binded to an exchange. org-queue is a durable queue and it has some additional properties as well.
Now I need to receive messages from this queue.
I have use the below code to get instance of the queue
conn = Bunny.new
conn.start
ch = conn.create_channel
q = ch.queue("org-queue")
It throws me an error stating different durable property. It seems by default the Bunny uses durable = false. So I've added durable true as parameter. Now it states the difference between other parameters. Do I need to specify all the parameters, to connect to it? As rabbitMQ is maintained by different environment, it is hard for me to get all the properties.
Is there a way to get list of queues and listening to the required queue in client instead of connecting to a queue by all parameters.
Have you tried the :passive=true parameter on queue()? A real example is the rabbitmq plugin of logstash. :passive means to only check queue existence rather than to declare it when consuming messages from it.
Based on the documentation here http://reference.rubybunny.info/Bunny/Queue.html and
http://reference.rubybunny.info/Bunny/Channel.html
Using the ch.queues() method you could get a hash of all the queues on that channel. Then once you find the instance of the queue you are wanting to connect to you could use the q.options() method to find out what options are on that rabbitmq queue.
Seems like a round about way to do it but might work. I haven't tested this as I don't have a rabbitmq server up at the moment.
Maybe there is way to get it with rabbitmqctl or the admin tool (I have forgotten the name), so the info about queue. Even if so, I would not bother.
There are two possible solutions that come to my mind.
First solution:
In general if you want to declare an already existing queue, it has to be with ALL correct parameters. So what I'm doing is having a helper function for declaring a specific queue (I'm using c++ client, so the API may be different but I'm sure concept is the same). For example, if I have 10 subscribers that are consuming queue1, and each of them needs to declare the queue in the same way, I will simply write a util that declares this queue and that's that.
Before the second solution a little something: Maybe here is the case in which we come to a misconception that happens too often :)
You don't really need a specific queue to get the messages from that queue. What you need is a queue and the correct binding. When sending a message, you are not really sending to the queue, but to the exchange, sometimes with routing key, sometimes without one - let's say with. On the receiving end you need a queue to consume a message, so naturally you declare one, and bind it to an exchange with a routing key. You don't need even need the name of the queue explicitly, server will provide a generic one for you, so that you can use it when binding.
Second solution:
relies on the fact that
It is perfectly legal to bind multiple queues with the same binding
key
(found here https://www.rabbitmq.com/tutorials/tutorial-four-java.html)
So each of your subscribers can delcare a queue in whatever way they want, as long as they do the binding correctly. Of course these would be different queues with different names.
I would not recommend this. This implies that every message goes to two queues for example and most likely a message (I am assuming the use case here needs to be processed only once by one subscriber).

Resources