postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

receive raw message instead of object #308

Open juliangruber opened 10 years ago

juliangruber commented 10 years ago

For perf I'd like to deal with a string of json on the receiver side instead of an object. I saw in lib/queue.js (https://github.com/postwait/node-amqp/blob/master/lib/queue.js#L125) that json parsing is enabled through message headers (right?) but in my case I can't alter the sender site to override that header. Is there an option that I'm missing, or would you be interested in a pull request for this feature?

glenjamin commented 10 years ago

You can do this using queue.subscribeRaw, but unfortunately you lose a bit more than just json parsing. This is currently the simplest way to achieve this as far as I can tell.