Products Downloads


French version


 

      

      

      


EADELIA





(B) (C)

Section for use

onError / onMessage

Syntax

In an onMessage section

BRK_GET_MSG <result variable> encoding

encoding

Null | *ENCODING(EncodingValue)

EncodingValue

<AlphaConstant> | <AlphaVarId>



BRK_GET_MSG AlphaPropertyName <result variable>


In an onError section

BRK_GET_MSG ErrorInfoType <result variable>

ErrorInfoType

*ERROR_CODE | *IMMED_STOP | * ERROR_MSG

Description

In an onMessage section

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 brokerNative payload typeCompatible Adelia types
KafkaAvro / Double / Integer / Long / Short / String / Byte arrayALPHA / IMAGE / REF_CLASS / NUM_E / NUM_P / NUM_BIN_2 / NUM_BIN_4 / NUM_BIN_8
Nats JetstreamByte arrayALPHA / IMAGE / REF_CLASS
MQTT v3Byte arrayALPHA / IMAGE / REF_CLASS
MQTT v5Byte arrayALPHA / IMAGE / REF_CLASS
RabbitMQ AMQPByte arrayALPHA / IMAGE / REF_CLASS
Redis Pub/SubByte array/AlphanumericALPHA / IMAGE / REF_CLASS


REF_CLASS result variable:

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 valueProperty descriptionProperty type
offsetPosition of the message in the associated Kafka partition.NUM_BIN_8
topicName of the topic the message is from.ALPHA(n)
partition

Partition the message is received from.

ALPHA(n)
keyKey associated with the message (this key may not exist if the issuer has not associated a key with the message).ALPHA / IMAGE / REF_CLASS / NUM_E / NUM_P / NUM_BIN_2 / NUM_BIN_4 / NUM_BIN_8
timestampMessage timestamp.NUM_BIN_8 / TIMESTAMP
firstPolledWhen 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
lastPolledWhen 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/keysList of <key, value> pair keys included in the message header.ALPHA(n) array
headers/valuesList 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 valueProperty descriptionProperty type
topicName of the topic the message is from.ALPHA(n)
idMessage 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
qosReturns the quality of service associated with the message (value 0, 1 or 2).NUM_BIN_4
Message from MQTT v5
Key valueProperty descriptionProperty type
topicName of the topic the message is from.ALPHA(n)
idMessage 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
qosReturns the quality of service associated with the message (value 0, 1 or 2).NUM_BIN_4
properties
propertiesMessage properties.N / A
properties/validPropertiesList of the numbers of message properties defined for this message (see MqttProperties Java class).NUM_BIN_2 array
properties/assignedClientIdentifierAssigned client identifier (property number 18).ALPHA(n)
properties/contentTypeMessage content type (property number 3).ALPHA(n)
properties/correlationDataCorrelation data (property number 9).IMAGE
properties/payloadFormatMessage 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/responseTopicName of topic for a response message (property number 8).ALPHA(n)
properties/subscriptionIdentifierSubscriber identifier (property number 11).NUM_BIN_4
properties/topicAliasMessage topic alias (property number 35).NUM_BIN_4
properties/userPropertiesUser 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.N / A
adelUtils:collectionSize(properties/userProperties)Size of user properties list.NUM_BIN_4
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 valueProperty descriptionProperty 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
headersKey/values cross-reference table associated with the message. A key is alphanumeric type and the value is an alphanumeric list.N / A
headers/sizeSize of the key/values cross-reference table associated with the message (corresponds to the number of table entries).NUM_BIN_4
headers/emptySpecifies if the key/values cross-reference table associated with the message is empty (size 0).BOOL
headers/keySetReturns 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/entrySetReturns 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]/keyReturns 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]/valueReturns 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 valueProperty descriptionProperty type
envelope
envelopeMessage envelope.N / A
envelope/exchangeName of exchange associated with the message.ALPHA(n)
envelope/redeliverSpecifies if the message is redelivered.BOOL
envelope/routingKeyRouting key associated with the message.ALPHA(n)
basicProperties
basicPropertiesMessage properties.N / A
basicProperties/contentTypeMessage payload content type.ALPHA(n)
basicProperties/contentEncodingMessage payload content encoding.ALPHA(n)
basicProperties/deliveryModeMessage 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.NUM_BIN_4
basicProperties/priorityMessage priority in the associated queue.NUM_BIN_4
basicProperties/correlationIdMessage correlation ID.ALPHA(n)
basicProperties/replyToName of the queue to use to reply to the message.ALPHA(n)
basicProperties/expirationMessage lifespan in milliseconds.ALPHA(n)
basicProperties/messageIdMessage application ID.ALPHA(n)
basicProperties/timestampMessage application timestamp.TIMESTAMP / TIME / DATE
basicProperties/typeMessage application type.ALPHA(n)
basicProperties/userIdID of user who published the message.ALPHA(n)
basicProperties/appIdID of application that published the message.ALPHA(n)
Message from Redis Pub/Sub
Key valueProperty descriptionProperty type
channel

Name of the channel the message is from

ALPHA(n)/IMAGE according to the value of the config/brokerConfig/subscribeTopic/redisCodec property.
pattern

Name of pattern the channel is deduced from.

ALPHA(n)/IMAGE according to the value of the config/brokerConfig/subscribeTopic/redisCodec property.



In an onError section

This instruction retrieves information relating to the error during processing.

ErrorInfoTypeProperty descriptionProperty type
*ERROR_CODEError numberNUM_BIN_4
*IMMED_STOPSpecifies if the error will stop the subscriber (and trigger the execution of the onStop section).BOOL
*ERROR_MSGError messageALPHA(n)



The error depends on the execution context and therefore the broker (and the associated factory).

Specific Kafka errors
Error numberError messageImmediate stop
-401Error when creating the topic pattern.

Yes

-403Error when handling the ON_START event: negative acknowledgment sent.Yes
-501

Error when converting an Avro pojo to an Adelia pojo.

No
Specific MQTT v3 errors
Error numberError messageImmediate stop
-401

Error when creating Paho MQTTv3 connection options based on the broker connection configuration.

Yes
-402Error when creating the Paho MQTTv3 client using the options.Yes
-403

Error when connecting the Paho MQTTv3 client to the broker.

Yes
-404Error when subscribing the Paho MQTTv3 client to the topics.Yes
-406Error when handling the ON_START event: negative acknowledgment sent.Yes
-501Broker connection lost.Yes
-502Error when force disconnecting the Paho MQTTv3 client.Yes
-503Error when closing the Paho MQTTv3 client.Yes
Specific MQTT v5 errors
Error numberError messageImmediate stop
-401Error when creating Paho MQTTv5 connection options based on the broker connection configuration.Yes
-402Error when creating the Paho MQTTv5 client using the options.Yes
-403Error when connecting the Paho MQTTv5 client to the broker.Yes
-404Error when subscribing the Paho MQTTv5 client to the topics.Yes
-406Error when handling the ON_START event: negative acknowledgment sent.Yes
-501Broker connection lost.Yes
-502Error when force disconnecting the Paho MQTTv5 client.Yes
-503Error when closing the Paho MQTTv5 client.Yes
Specific NATS JetStream errors
Error numberError messageImmediate stop
-401Error when creating NATS connection options based on the broker connection configuration.Yes
-402Error when creating the NATS connection using the connection options.Yes
-403Error when creating JetStream subscription options based on the topic subscription configuration.Yes
-404Error when creating the JetStream context.Yes
-405Error when creating JetStream context options based on the broker connection configuration.Yes
-406Error when subscribing to JetStream broker topics.Yes
-408Error when handling the ON_START event: negative acknowledgment sent.Yes
-501Error when unsubscribing from JetStream broker topics.Yes
-502Error when closing the NATS connection to the broker.Yes
Specific RabbitMQ AMQP errors
Error numberError messageImmediate stop
-401Error when configuring the SSL connection: key management exception for all operations concerning key management.Yes
-402Error when creating the AMQP connection.Yes
-403Error when creating the AMQP channel.Yes
-404Error when passively declaring the queue.Yes
-405Error when declaring the queue.Yes
-406Error during basic consumption in the queue.Yes
-407Error when calling channel.basicQos.Yes
-408Error when passively declaring the exchanger.Yes
-409Error when declaring the exchanger.Yes
-410Error when binding the queue.Yes
-412Error when handling the ON_START event: negative acknowledgment sent.Yes
-501Error when closing the channel.Yes
-502Error when closing the connection.Yes
-503Connection closure not initiated by the application.Yes/No (after enabling automatic reconnection)
-504The subscriber was cancelled by the broker.Yes
Specific Redis Pub/Sub errors
Error numberError messageImmediate stop
-401Error when creating the Redis URI based on the broker connection configuration.Yes
-402Error when creating the ClientOptions/ClusterClientOptions options object based on the broker connection configuration.Yes
-403Error when creating the Pub/Sub connection to the Redis broker.Yes
-404Error when subscribing to broker channels and models.Yes
-406Error when handling the ON_START event: negative acknowledgment sent.Yes
-501Error when closing the connection to the Redis broker.Yes
-502Error when closing the Redis client.Yes
-503Lettuce Redis client closed due to loss of connection to the broker.Yes
-504Lettuce Redis client closed due to a communication error with the broker.Yes


After this instruction has been executed, the *RETURN_CODE reserved word can take the following values:

0 (*NORMAL)

Operation completed successfully.

-1

Internal error (no message or configuration).

-2

Internal error (no error).

-3

XPath syntax error when evaluating the Alpha PropertyName parameter.

-4

The reserved word parameter is not known.

-5 The key corresponds to information that does not exist or has no value.
-11 The value associated with the key cannot be converted to Adelia type.
-32 The result variable must be an ALPHA or REF_CLASS type variable.
-33 The ALPHA result variable is too short.
-53 The result variable must be a numeric variable.
-54 The NUM_E/NUM_P result variable is too small.
-55 The integer part of the NUM_E/NUM_P result variable is too small.
-56 The decimal part of the NUM_E/NUM_P result variable is too small.
-57 The result variable has a type which is incompatible with a numeric value.
-58 The NUM_BIN_2 result variable is too small.
-59 The NUM_BIN_4 result variable is too small.
-60 The NUM_BIN_8 result variable is too small.
-61 The value associated with the key cannot be converted to TIMESTAMP type.
-74 The result variable must be a Boolean variable.
-95 The result variable must be a DATE, TIME or TIMESTAMP variable.
-116 The result variable must be an IMAGE variable.
-117

The value associated with the key cannot be converted to a byte array.

-137 The resulting variable must be a REF_CLASS variable.
-138 The value associated with the key cannot be converted to an Adelia class.
-300 The result variable must be an array variable.
-301 The result variable must be a one-dimensional array variable.
-302 The array result variable is too small.
-303 The combo box items have a type that cannot be converted to a numerical value.
-304 The combo box items have a type that cannot be converted to an alphanumeric value.
-305 The combo box items have a type that cannot be converted to a Boolean value.
-306 The combo box items have a type that cannot be converted to an image value.
-307 The combo box items have a type that cannot be converted to an Adelia class value.
-308 The result variable type is not supported.
-309 The key's combo box items have a type that cannot be converted to a date/time/timestamp value.
-332 The result array variable must be ALPHA or REF_CLASS type.
-333 The alphanumeric length of the ALPHA result array variable is too short.
-353 The result array variable must be numeric.
-354 The NUM_E/NUM_P result array variable defines numerics that are too small.
-355 The NUM_E/NUM_P result array variable defines numerics with an integer part that is too small.
-356 The NUM_E/NUM_P result array variable defines numerics with a decimal part that is too small.
-357 The combo box items have a type that cannot be converted to a numerical value.
-358 The NUM_BIN_2 result array variable defines integers that are too small.
-359 The NUM_BIN_4 result array variable defines integers that are too small.
-360 The NUM_BIN_8 result array variable defines integers that are too small.
-361 The key's combo box items have a value that cannot be converted to TIMESTAMP type.
-374 The result array variable must be Boolean type.
-395 The result array variable must be date, time or timestamp type.
-416 The result array variable must be image type.
-417 The key's combo box items have a type that cannot be converted to a byte array.
-437 The result array variable must be REF_CLASS type.
-438 The key's combo box items have a type that cannot be converted to an Adelia class.
-600 The value associated with the key cannot be converted to Adelia type.
-621 The alphanumeric value associated with the key cannot be deserialized to an Adelia class.
-642 The numeric value associated with the key cannot be converted to Adelia numeric type.
-705 Error when retrieving the byte array from a ByteBuffer instance.
-706

The ByteBuffer instance has no accessible byte array.

-707 The byte array value associated with the key cannot be deserialized to an Adelia class.
-708 Invalid character encoding.
-709 Error when converting the payload to an alphanumeric string.
-900 The value associated with the key cannot be converted to Adelia type.
-1521 The alphanumeric value associated with the key cannot be deserialized to an Adelia class.
-1542 The numeric value associated with the key cannot be converted to Adelia numeric type.
-1605 Error when retrieving the byte array from a ByteBuffer instance.
-1606 The ByteBuffer instance has no accessible byte array.
-1607 The byte array value associated with the key cannot be deserialized to an Adelia class.
-1608 Character encoding is invalid for converting the byte array.
-1609 Error when converting a byte array value to an alphanumeric string.

For example

* Payload retrieved in the form of an Adelia class (onMessage)

REF_CLASS(COMMAND_ORDER) myCommand

BRK_GET_MSG myCommand


* Topic retrieved from a Kafka message (onMessage)

ALPHA(10) msgTopic


BRK_GET_MSG 'topic' msgTopic


* Error code retrieved (onError)

NUM_BIN_4 ambssError

BRK_GET_MSG ERROR_CODE ambssError



↑ Top of page



  • Aucune étiquette