This instruction retrieves information contained in the received message.
Retrieving a message's payload.
BRK_GET_MSG <result variable> <encoding>
When this instruction is called, the result variable receives the payload contained in the message. The variable type depends on the type of payload supported by the message broker.
Message broker
Native payload type
Compatible Adelia types
Kafka
Avro / Double / Integer / Long / Short / String / Byte array
If the result variable is REF_CLASS, we assume that the payload is JSON data (alphanumeric or byte array) encoded in UTF-8. JSON deserialization is applied to this data to populate the REF_CLASS variable.
Deserialization is based on the third-party Jackson converter: the converter's default properties can be modified by entering the customObjectMapper property of the Adelia subscriber.
ALPHA result variable and encoding:
If the result variable is ALPHA and the payload is a byte array, character encoding to be used when converting the byte array to an alphanumeric string can be specified. This encoding value must be included in the character set registry defined by the IANA. It must also be included in the character sets supported by the JVM.
When encoding is specified, the conversion is carried out according to the encoding value.
When no encoding is specified, the conversion rules vary according to the target broker and the properties of the message to process.
Message broker
Conversion rule.
Kafka
The encoding used is the default encoding of the JVM executing the AMBSS.
Nats Jetstream
The encoding used is the default encoding of the JVM executing the AMBSS.
MQTT v3
The encoding used is the default encoding of the JVM executing the AMBSS.
MQTT v5
If the message's properties/payloadFormat property is true, UTF-8 encoding is used. If not, the encoding used is the default encoding of the JVM executing the AMBSS.
RabbitMQ AMQP
If the message has the basicProperties/contentEncoding property and it defines valid character encoding, this encoding is used. If not, the encoding used is the default encoding of the JVM executing the AMBSS.
Redis Pub/Sub
The encoding used is the default encoding of the JVM executing the AMBSS.
Retrieving a property from a message
BRK_GET_MSG AlphaPropertyName <result variable>
This instruction is used to retrieve information about the message (apart from payload). Each item of information is defined by a key (AlphaPropertyName parameter) and has an associated typed value (result variable parameter).
The key can be defined either by an alphanumeric variable or by an alphanumeric literal. Its value represents an XPath expression and designates a native property of the message, so dependent upon the message broker associated with the Adelia subscriber.
Message from Kafka
Key value
Property description
Property type
offset
Position of the message in the associated Kafka partition.
NUM_BIN_8
topic
Name of the topic the message is from.
ALPHA(n)
partition
Partition the message is received from.
ALPHA(n)
key
Key associated with the message (this key may not exist if the issuer has not associated a key with the message).
When the ackMode property is "MANUAL" or "MANUAL_IMMEDIATE" and the typeMsgHandling property is "BATCH", this key indicates if the message is the first message in the batch to handle.
BOOL
lastPolled
When the ackMode property is "MANUAL" or "MANUAL_IMMEDIATE" and the typeMsgHandling property is "BATCH", this key indicates if the message is the last message in the batch to handle.
BOOL
headers/keys
List of <key, value> pair keys included in the message header.
ALPHA(n) array
headers/values
List of <key, value> pair keys included in the message header. The native value type is a byte array.
ALPHA / IMAGE / REF_CLASS
Message from MQTT v3
Key value
Property description
Property type
topic
Name of the topic the message is from.
ALPHA(n)
id
Message ID.
NUM_BIN_4
duplicate
Specifies whether or not this message can be a duplicate of a message already received.
BOOL
retained
Returns whether or not this message has been retained by the broker. Specifies whether or not the message came from a running issuer or if it was "retained" by the broker as the last message published on the topic.
BOOL
qos
Returns the quality of service associated with the message (value 0, 1 or 2).
NUM_BIN_4
Message from MQTT v5
Key value
Property description
Property type
topic
Name of the topic the message is from.
ALPHA(n)
id
Message ID.
NUM_BIN_4
duplicate
Specifies whether or not this message can be a duplicate of a message already received.
BOOL
retained
Returns whether or not this message has been retained by the broker. Specifies whether or not the message came from a running issuer or if it was "retained" by the broker as the last message published on the topic.
BOOL
qos
Returns the quality of service associated with the message (value 0, 1 or 2).
NUM_BIN_4
properties
properties
Message properties.
N / A
properties/validProperties
List of the numbers of message properties defined for this message (see MqttProperties Java class).
NUM_BIN_2 array
properties/assignedClientIdentifier
Assigned client identifier (property number 18).
ALPHA(n)
properties/contentType
Message content type (property number 3).
ALPHA(n)
properties/correlationData
Correlation data (property number 9).
IMAGE
properties/payloadFormat
Message payload format (property number 1). If the value is true, the payload represents a character string encoded in UTF-8. If the value is false, the payload is raw data without a format (byte array).
BOOL
properties/messageExpiryInterval
Message expiry interval (property number 2). This value corresponds to the message lifespan in seconds. If the message expiry interval has passed and the broker has not managed to start delivery to a corresponding subscriber, it must delete the copy of the message for this subscriber.
NUM_BIN_8
properties/responseTopic
Name of topic for a response message (property number 8).
ALPHA(n)
properties/subscriptionIdentifier
Subscriber identifier (property number 11).
NUM_BIN_4
properties/topicAlias
Message topic alias (property number 35).
NUM_BIN_4
properties/userProperties
User properties (property number 38). List of <key, value> alphanumeric pairs. These properties can be used to provide additional information to the broker or client, including diagnostic information.
properties/userProperties[<index starting at 1>]/key
<index> index pair key field value in the user properties list.
ALPHA(n)
properties/userProperties[<index starting at 1>]/value
<index> index pair value field value in the user properties list.
ALPHA(n)
Message from Nats Jetstream
Key value
Property description
Property type
jetStream
Check if the message is from Jetstream or if it is a standard message (returns yes if the message is from Jetstream).
BOOL
sid
ID associated with the subscription, used by the connection when handling an incoming message from the broker.
ALPHA(n)
utf8mode
Specifies if the message subject is encoded in UTF-8.
BOOL
hasHeaders
Checks if the message contains header properties (returns true if the message contains them).
BOOL
subject
Subject to which the message was sent.
ALPHA(n)
replyTo
Subject to which the application is supposed to send a reply message.
ALPHA(n)
headers
headers
Key/values cross-reference table associated with the message. A key is alphanumeric type and the value is an alphanumeric list.
N / A
headers/size
Size of the key/values cross-reference table associated with the message (corresponds to the number of table entries).
NUM_BIN_4
headers/empty
Specifies if the key/values cross-reference table associated with the message is empty (size 0).
BOOL
headers/keySet
Returns the list of keys (corresponding to the entries in the key/values cross-reference table associated with the message).
ALPHA(n) array
headers/keySet[<index starting at 1>]
Returns the <index> index key value in the key list.
ALPHA(n)
headers/entrySet
Returns the list of <key, value> pairs included in the key/values cross-reference table associated with the message.
N / A
headers/entrySet[<index starting at 1]/key
Returns the value of the key associated with the <index> index pair in the list of <key, value> pairs.
ALPHA(n)
headers/entrySet[<index starting at 1]/value
Returns the value of the value field associated with the <index> index pair in the list of <key, value> pairs.
ALPHA(n) array
Message from RabbitMQ AMQP
Key value
Property description
Property type
envelope
envelope
Message envelope.
N / A
envelope/exchange
Name of exchange associated with the message.
ALPHA(n)
envelope/redeliver
Specifies if the message is redelivered.
BOOL
envelope/routingKey
Routing key associated with the message.
ALPHA(n)
basicProperties
basicProperties
Message properties.
N / A
basicProperties/contentType
Message payload content type.
ALPHA(n)
basicProperties/contentEncoding
Message payload content encoding.
ALPHA(n)
basicProperties/deliveryMode
Message delivery mode (persistent message or not). Value 1 indicates that this message is only stored in memory; value 2 indicates that it is stored on a disk.