8

While running the app in consumer mode, my application is frequently crashing with an error Error: Channel closed by server: 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'x-max-priority' for queue 'xyz' in vhost '/': received the value '10' of type 'byte' but current is none". Does anyone know the fix for this issue?

kavigun
  • 2,219
  • 2
  • 14
  • 33
  • What do you mean by "consumer mode"? The error you are seeing is not being sent by Node unless you have specifically written the server to require request preconditions and to return this error. Perhaps if you were to include the relevant source code, and identify the server you're trying to communication with, I might be able to help more. – Rob Raisch Jul 11 '19 at 22:15
  • Hey Rob, Sorry, for the delay in responding back. By "consumer mode" - I meant the RMQ consumer app. I was wondering why this was happening though I had `x-max-priority`: 10. Deleting the queue worked for me. – kavigun Nov 29 '19 at 14:43

4 Answers4

5

@here Deleting the queue 'xyz' worked for me.

kavigun
  • 2,219
  • 2
  • 14
  • 33
1

It appears that you're making a call to a server that requires one or more preconditions to be met before it will return a result. Since this is a remote server call, you'd need to check the API documentation to determine what precondition(s) is/are required, or if there is no API documentation, contact the manager of the server in question.

See 406 HTTP "Not Acceptable" Status Code for more about this particular error.

Rob Raisch
  • 17,040
  • 4
  • 48
  • 58
  • Yes, with the error logs even I thought the same in the beginning. The pre-condition to be checked was `x-max-priority`. But the `x-max-priority` was set to 10 which was the requirement. And hence the issue was confusing. – kavigun Nov 29 '19 at 14:47
0

While the exception of assertQueue still exists, but I found that I don't need to run assertqueue before consuming .. so for now I just commented the assertQueue call. and consuming is working.

I don't know why all examples of ameplib run assertQueue before anything?!

Awais Ayub
  • 389
  • 3
  • 13
  • When RabbitMQ quits or crashes it will forget the queues and messages unless you tell it not to. So, it is important that we assert the queue before sending/consuming messages from a queue. To send/consume a message, we must declare a queue. Declaring a queue is idempotent - it will only be created if it doesn't exist already. – kavigun Sep 18 '20 at 18:04
0

406 ERROR also may occur if the queueNamed channel is acknowledeged more than once, Make sure channel ack type is set to manual, {noAck: false}. this closes the queueChannel which causes the consumer/publisher to not be able to access the queueChannel.

Note: Make sure you ack the queue in the same order it is received by the system. If your handling many publishers and consumers in single functionality also check if you have pre acked the channel.