How to use the azure-iot-amqp-base.AmqpMessage.fromMessage function in azure-iot-amqp-base

To help you get started, we’ve selected a few azure-iot-amqp-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-node / device / transport / amqp / src / amqp.ts View on Github external
sendEvent: (message, sendCallback) => {
            let amqpMessage = AmqpMessage.fromMessage(message);
            amqpMessage.properties.to = this._d2cEndpoint;

            /*Codes_SRS_NODE_DEVICE_AMQP_16_025: [The `sendEvent` method shall create and attach the d2c link if necessary.]*/
            if (!this._d2cLink) {
              this._amqp.attachSenderLink(this._d2cEndpoint, null, (err, link) => {
                if (err) {
                  handleResult('AMQP Transport: Could not send', sendCallback)(err);
                } else {
                  debug('got a new D2C link');
                  this._d2cLink = link;
                  this._d2cLink.on('error', this._d2cErrorListener);
                  this._d2cLink.send(amqpMessage, handleResult('AMQP Transport: Could not send', sendCallback));
                }
              });
            } else {
              debug('using existing d2c link');
github Azure / azure-iot-sdk-node / service / src / amqp.ts View on Github external
send(deviceId: string, message: Message, done: Client.Callback): void {
    const deviceEndpoint = endpoint.deviceMessagePath(encodeURIComponent(deviceId));
    /*Codes_SRS_NODE_IOTHUB_SERVICE_AMQP_16_002: [The `send` method shall construct an AMQP request using the message passed in argument as the body of the message.]*/
    let amqpMessage = AmqpMessage.fromMessage(message);
    this._fsm.handle('send', amqpMessage, deviceEndpoint, handleResult('AMQP Transport: Could not send message', done));
  }

azure-iot-amqp-base

AMQP operations used by Azure IoT device and service SDKs

MIT
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages