Functions of ballerina.lang.messages package
function addHeader(message m, string key, string value)
Adds a transport header to the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
key | string | The header name |
value | string | The header value |
function clone(message m) (message )
Clones and creates a new instance of a message object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
message | The new instance of the message object |
function getBinaryPayload(message m) (blob )
Gets the message payload in BLOB format
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
blob | json: The BLOB reresentation of the message payload |
function getHeader(message m, string headerName) (string )
Gets a transport header from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
headerName | string | The header name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The header value |
function getHeaders(message m, string headerName) (string[] )
Gets transport headers from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
headerName | string | The header name |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string[] | string[]: The header values |
function getJsonPayload(message m) (json )
Gets the message payload in JSON format
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
json | The JSON reresentation of the message payload |
function getProperty(message msg, string propertyName) (string )
Retrieve a message property
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
msg | message | The current message object |
propertyName | string | The name of the property |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The property value |
function getStringPayload(message m) (string )
Gets the message payload in string format
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The string representation of the message payload |
function getStringValue(message m, string propertyName) (string )
To get the value for a string property in a map type message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | message: message |
propertyName | string | Name of the property |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The value of the map property |
function getXmlPayload(message m) (xml )
Gets the message payload in XML format
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | The XML representation of the message payload |
function removeAllHeaders(message m)
Removes all transport headers from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
function removeHeader(message m, string key)
Removes a transport header from the message
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
key | string | The header name |
function setHeader(message m, string key, string value)
Sets the value of a transport header
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The message object |
key | string | The header name |
value | string | The header value |
function setJsonPayload(message m, json payload)
Sets the message payload using a JSON object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The current message object |
payload | json | The JSON payload object |
function setMapPayload(message msg, map payload)
Sets the message payload using a map object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
msg | message | The current message object |
payload | map | The map payload object |
function setProperty(message msg, string propertyName, string propertyValue)
Sets a message property
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
msg | message | The current message object |
propertyName | string | The name of the property |
propertyValue | string | The value of the property |
function setStringPayload(message m, string payload)
Sets the message payload using a string object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The current message object |
payload | string | The string payload object |
function setXmlPayload(message m, xml payload)
Sets the message payload using an XML object
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
m | message | The current message object |
payload | xml | The XML payload object |