Skip to content

qie.createTextMessage

Signature: qie.createTextMessage(value*, encoding*)

Returns: Text Message message - the newly created message object

Replace the current message with an empty Plain Text formatted message.

Note

The return value MUST ALWAYS be assigned to the bound-in message object.

Note

encoding is optional. When not specified, {source encoding} is the encoding set on the channel's source node, or the encoding of the current message when the channel has none.

Parameters

Type Name Description Default
String or byte[] value* (optional) the initial message value as a string or byte array
String encoding* (optional) the character encoding for this message {source encoding}

Example

// createTextMessage examples:
// Example: value as String
message = qie.createTextMessage(
   "I like simple text messages.",
   "UTF-8"
);


// Example: value as byte[]
var textBytes = [
   72,101,108,108,111,32,84,101,120,116,32,77,101,115,115,97,103,101
]; // "Hello Text Message"
message = qie.createTextMessage(
   textBytes,
   "UTF-8"
);


// Example: no value provided
message = qie.createTextMessage();