Creates a new AMQP message in binary form
The body of the message
Optional message properties as defined by the application
Agent AMQP functionality is currently only available to development devices. Any attempt to interact with imp API amqp objects and methods on production devices will generate a runtime error.
This method creates a new AMQP message and encodes it in binary form for transmission. This contrasts with amqp.createmessage() which creates a new message that is encoded as a UTF-8 string.
The method is provided because some AMQP brokers are unable to deserialize JSON from a UTF-8 string (‘AMQP VALUE’, the default type) and require that the data be encoded as binary (‘AMQP DATA’) format in the AMQP packets. For example, Azure Stream Analytics returns the error message, “Could not deserialize the input event as Json...”, if you attempt to send JSON encoded as UTF-8.
If the optional properties parameter is supplied, it will be used to construct the message. The keys which make up the properties table are application specific. For example, communicating with Microsoft’s Azure IoT Hub AMQP broker requires three properties keys and accompanying values for authentication: operation, type and name. The properties table keys must always be strings, and their values can only be of the following types: Integer, Float, Boolean or String. Passing in any other types is not currently supported, and an attempt will be made to convert them to a string.
Messages, once created, are immutable. If you need to update a message, you should create a new one with updated body and, optionally, properties data.