in src/service_receiver.ts [17:31]
constructor(receiver: ReceiverLink) {
super();
this._receiver = receiver;
/*Codes_SRS_NODE_SERVICE_RECEIVER_16_001: [The constructor shall subscribe to the `message` event of the `ReceiverLink` object passed as argument.]*/
this._receiver.on('message', (amqpMessage) => {
/*Codes_SRS_NODE_SERVICE_RECEIVER_16_006: [The `ServiceReceiver` class shall convert any `AmqpMessage` received with the `message` event from the `ReceiverLink` object into `Message` objects and emit a `message` event with that newly created `Message` object for argument.]*/
this.emit('message', AmqpMessage.toMessage(amqpMessage));
});
/*Codes_SRS_NODE_SERVICE_RECEIVER_16_002: [The constructor shall subscribe to the `error` event of the `ReceiverLink` object passed as argument.]*/
this._receiver.on('error', (err) => {
/*Codes_SRS_NODE_SERVICE_RECEIVER_16_007: [Any error event received from the `ReceiverLink` object shall be forwarded as is.]*/
this.emit('error', err);
});
}