[rabbitmq-discuss] Dead Letter and Unknown Field?

Jordan jordannpotter at gmail.com
Sun Sep 23 02:37:28 BST 2012


I'm trying to perform rpc on top of rabbitmq.  However, if a rpc request 
sits idle in the queue for 2 seconds, I want the message to be dropped from 
the queue and for the client to throw an error.

To do this, I've been playing around with dead letter exchanges.  However, 
I keep seeing:

/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:350
        throw new Error("Unknown field value type " + 
buffer[buffer.read-1]);
              ^
Error: Unknown field value type 65
    at parseTable 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:350:15)
    at parseFields 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:410:17)
    at AMQPParser._parseHeaderFrame 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:469:20)
    at frameEnd 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:190:16)
    at frame (/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:172:14)
    at header 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:159:14)
    at frameEnd 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:205:16)
    at frame (/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:172:14)
    at AMQPParser.header [as parse] 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:159:14)
    at AMQPParser.execute 
(/Users/jordan/agles/web/back/node_modules/amqp/amqp.js:231:21)



Here's my clientTest.coffee:

amqp = require 'amqp'

connection = amqp.createConnection()
connection.on 'ready', () ->
await
connection.exchange 'rpc exchange', type: 'direct', defer exchange
connection.exchange 'dead letter exchange', type: 'fanout', defer 
deadLetterExchange

await
connection.queue '', exclusive: true, defer responseQueue
connection.queue '', exclusive: true, defer deadLetterQueue

deadLetterQueue.bind deadLetterExchange, ''

responseQueue.subscribe (message, headers, deliveryInformation) =>
console.log 'responseQueue received: ' + message.data

deadLetterQueue.subscribe (message, headers, deliveryInformation) =>
console.log 'deadLetterQueue received: ' + message.data

startMakingRandomRequests exchange, responseQueue

startMakingRandomRequests = (exchange, responseQueue) ->
setInterval (()-> makeRandomRequest exchange, responseQueue), 2000

makeRandomRequest = (exchange, responseQueue) ->
message = Math.random().toString()
exchange.publish 'rpc', message,
replyTo: responseQueue.name
console.log 'sent: ' + message


And here's my serverTest.coffee:

amqp = require 'amqp'

connection = amqp.createConnection()
connection.on 'ready', () =>
await
connection.exchange 'rpc exchange', type: 'direct', defer exchange
connection.exchange 'dead letter exchange', type: 'fanout', defer 
deadLetterExchange

queueArguments = 
'x-message-ttl': 0
'x-dead-letter-exchange': 'dead letter exchange'

await 
connection.queue '', arguments: queueArguments, defer queue

queue.bind exchange, 'rpc'

queue.subscribe ack: true, (message, headers, deliveryInformation) ->
console.log 'received: ' + message.data
connection.publish deliveryInformation.replyTo, message.data
console.log 'sent: ' + message.data
# queue.shift()  NOT GOING TO SHIFT SO I CAN TEST DEAD LETTER



Does anyone have any idea what's going on here?  Hopefully I'm making a 
stupid mistake :(

Thanks guys,
Jordan 







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120922/64904ec0/attachment.htm>


More information about the rabbitmq-discuss mailing list