EzDevInfo.com

rabbit.js

Messaging in Node.JS made easy using RabbitMQ

How can I determine what sort of socket I should use to get messages from a RabbitMQ queue?

I'm using Rabbit.js to connect to a queue on a remote server. The issue is that every time I try to connect I get:

Error: Channel closed by server: 406 (PRECONDITION-FAILED) with message 
  "PRECONDITION_FAILED - inequivalent arg 'durable' for exchange 'WorkOrderQuery.Response' in vhost '/': received 'false' but current is 'true'"
  at Channel.C.accept (/Users/collumj/work/alpha/node_modules/rabbit.js/node_modules/amqplib/lib/channel.js:398:24)
  at Connection.mainAccept [as accept] (/Users/collumj/work/alpha/node_modules/rabbit.js/node_modules/amqplib/lib/connection.js:63:33)

I can provide code if needed. I've tried passing an options object with durable: true at relevant points to no effect. Everything is firing off in the correct order but I am always getting the error about the durable value being set wrong.

The question is: how do I look at a queue's page on the RabbitMQ server and determine what sort of socket I should use to connect to it? I can try a few but trying things blindly isn't a great way to go so I'd rather know that I'm using the right type.

It's possible that these two things have nothing to do with each other. If so, I'd appreciate an explanation because I'm clearly missing it.

Here's an image of my RabbitMQ Queue page:

enter image description here

Edit: changing my SUBSCRIBE socket to a PULL socket fixed it. Still not sure how I would have known (or if) from looking at the queue's page.


Source: (StackOverflow)

how to send a message to all subscribers except for the publisher which is also a listener on same rabbitMQ queue

i have a rabbitMQ installed used by a nodeJS server. i use rabbit.js library to interact with rabbit, and so far i was happy with it.

i got multiple subscribers on the same queue in fanout mode, each node which is a subscriber, is also a publisher this is good for me and works fine, because there are many situations in which i want to notify all servers about some update that happend on one of those nodes (which is also a publisher...)

i stumbled on a case in which i need to send all of the listeners on a queue a message, except for the one who sent it (which is also a listener on that same queue).

i don't know in advance who is listening (there could be single one, there could be millions), so i can't rout it to some specific nodes by some whitelist route rule. it must be some kind of an exclusion wildcard routing rule (some blacklist) for example, send this message to everyone who listens which don't correspond to my own unique id...

can it be done using rabbit.js? can it even be done in rabbitmq somehow?

i don't know rabbit that much... so be gentle with me :)

btw, if you know how to do it using rabbit.js, even better...

EDIT::

according to Derick Bailey's request here is the reason i need this

i have a system in which there are many load balanced nodeJS servers which operate as webServices. they are totally transparent to one another. none of them knows which other nodes exists. and i would like to keep it this way because this seperation makes it easier for me to better scale by just adding and removing other "parallel" nodes.

each of these nodes has his own in memory local cache service. and i stumbled on a situation in which a single node updates some entity. and now i need to make it possible for this node to notify all of the other parallel nodes (that might have the same entity in the cache) to invalidate it.

problem is that my node which sends the message (updating node) will also receive the message, since he is also a listener. so i want him to somehow exclude himself from the receivers list of that specific message... hence the need for some routing blacklist. (he knows himself, so i could make him route to everyone except for his own id... but he does not know even if someone is indeed listening on the other end... so it defenitly cannot be a whitelist)

hope my need is clearer now.

i already thought of a solution to my problem, but it requires extra development on my side, and i would like to avoid it by using the current abilities of rabbit (in case it is possible) i could just add a unique ID to the content of the message. then the sending node can recognize that this message came from him and ignore that message. but as you can obviously understand, this could get tricky because i need to consider additional pitfalls and other edge cases it might fail...

if someone can tell me how to do it using some rabbit existing configuration, i'll be more than glad to hear how :)


Source: (StackOverflow)

Advertisements