Skip to main content

amqptransfer.sendasync(callback)

Send a specific AMQP message asynchronously

Availability

Agent

Parameters

Name Type Description
callback Function A function that will be called when the message has been sent

Returns

Nothing

Description

Important Note Agent AMQP functionality is now deprecated and will shortly become unsupported. Any attempt to interact with imp API amqp objects and methods on unregistered development devices or on production devices will generate a runtime error.

If you are using or intend to use Azure IoTHub, we recommend you make use of MQTT instead of AMQP. Please see our Azure IoT Hub integration for more information.


This method initiates the message transfer. It operates asynchronously, allowing Squirrel execution to continue as soon as the method returns. The function registered with the callback parameter will be invoked once that message has been sent. It takes no parameters.

Example

This snippet logs the sending of a message via its amqptransfer object:

local transfer = messageSender.createtransfer(amqp.createmessage("Hello!"));
transfer.sendasync(function() {
  server.log("Message Transferred");
});