0

I am trying to receive message using nodejs + amqp receiver. I could observe that the binary data higher than 7f was shown as ef bf bd.

var messageHandler = function (myIdx, msg) {
    var data = new Buffer(msg.body)
    console.log(data)

Input : 33 01 00 00 31 00 42 00 32 00 31 00 00 00 91 10
Output : 33 01 00 00 31 00 42 00 32 00 31 00 00 00 ef bf bd 10

I think 8bit binary stream is being interpreted as 7bit character stream. Can someone please shed some light on this?

Praful
  • 157
  • 1
  • 5
  • 16

1 Answers1

0

As per the guidance from node-amqp10 owner i tried overriding the policy to avoid the encode/decode logic with below code and was able to retrieve raw data properly.

var client = new AMQPClient(Policy.merge({
  senderLink: {
    encoder: function(body) { return body; }
  },
  receiverLink: {
    decoder: function(body) { return body; } 
  }
}, Policy.EventHub));
Praful
  • 157
  • 1
  • 5
  • 16