Products Downloads


French version


 

Directions assigned to method parameters:

(I)

Input

(O)

Output

List of return codes for the various methods:

_NATS_ERR_OK Method run successfully.
_NATS_ERR_ERROR An unexpected error occurred.
_NATS_ERR_INVALID_PARAMETER Invalid parameter.
_NATS_ERR_NOT_CONNECTED Not connected.


Message acknowledgment. This method can only be called when processing the OnMessage event.

Syntax

CALL_METHOD ObjectName ACK_MESSAGE Mode Time ReturnCode

Parameters

Mode (I)

NUM_BIN_4

Acknowledgment mode. Possible values:

_NATS_ACK Acknowledge.
_NATS_NAK Reject (the message will be re-issued).
_NATS_TERM Terminate (the message will not be re-issued).
_NATS_IN_PROGRESS The message is being processed.

Mode (I)

NUM_BIN_4

NATS subject.

ReturnCode (O)

BOOL

Method's return code.

Connection to NATS.

Syntax

CALL_METHOD, ObjectName, CONNECT Urls Options ReturnCode

Parameters

Urls (I)

ALPHA(n)

List of NATS access URLs, separated by the ";" character.

If the parameter is empty, a connection is made to the local server (nats://localhost:4222).

Options (I)

ALPHA(n)

List of connection options in the form of a set of key/value pairs with the ":" character separating the key from the value and the ";" character separating the options.

The accepted options are:

clientID Client ID.
user User name for a user/password connection.
password User's password.
nkey User's private key, for connection via user key.
nkey_file Name of a file containing the user's private key, for connection via user key.
token JWT for connection via user token.
token_file Name of a file containing a JWT, for connection via user token.
creds_file Name of a file containing the NATS connection identifiers (Token + NKEY).

ReturnCode (O)

NUM_BIN_4

Method's return code.

Counts the number of values associated with a header. This method can only be called when processing the OnMessage event.

Syntax

CALL_METHOD ObjectName COUNT_HEADER_VALUES HeaderName ValuesNumber

Parameters

HeaderName (O)

ALPHA(250)

Header name.

ValuesNumber (O)

NUM_BIN_4

Number of values associated with the header.

Counts the headers associated with a message. This method can only be called when processing the OnMessage event.

Syntax

CALL_METHOD ObjectName COUNT_HEADERS HeadersNumber

Parameters

HeadersNumber (O)

NUM_BIN_4

Number of headers associated with the message.

Disconnecting from NATS. This method has no effect if you are not currently connected.

Syntax

CALL_METHOD ObjectName DISCONNECT

Retrieves the name of the nth header of a message. This method can only be called when processing the OnMessage event.

Syntax

CALL_METHOD ObjectName GET_HEADER_NAME HeaderNumber HeaderName

Parameters

HeaderNumber (I)

NUM_BIN_4

Header number.

HeaderName (O)

ALPHA(250)

Header name.

Counts the number of values associated with a header. This method can only be called when processing the OnMessage event.

Syntax

CALL_METHOD ObjectName GET_HEADER_VALUE HeaderName ValueNumber HeaderValue

Parameters

HeaderName (O)

ALPHA(250)

Header name.

ValueNumber (O)

NUM_BIN_4

Value number.

HeaderValue (O)

ALPHA(250)

Value of the nth header.

Send a message to a NATS subject.

Syntax

CALL_METHOD, ObjectName SEND_MESSAGE Subject ReplyTo Headers Message ReturnCode

Parameters

Subject (I)

ALPHA(250)

NATS subject.

ReplyTo (I)

ALPHA(250)

Subject to receive a response.

Headers (I)

ALPHA(n)

List of headers for the message in the form of a set of key/value pairs with the ":" character separating the header name from the value and the ";" character separating the headers.

Several values can be provided for a header by separating them with the "," character.

If the "," or ";" characters need to appear in a header value, you need to replace them with the following escape characters respectively: %2c and %3b.

Message (I)

ALPHA(n) or

IMAGE

Message body. If the body is an alphanumeric variable, it is converted into UTF-8.

ReturnCode (O)

NUM_BIN_4

Method's return code.

Subscribing to a NATS subject.

Syntax

CALL_METHOD ObjectName SUBSCRIBE Subject MaxNoMessages SubscriptionType Options ReturnCode

Parameters

Subject (I)

ALPHA(250)

NATS subject.

MaxNoMessages (I)

NUM_BIN_4

Maximum number of messages to read. If MaxNoMessages is > 0, the subscriber will stop automatically after reading MaxNoMessages messages.

SubscriptionType (I)

NUM_BIN_4

Subscription type.

_NATS_CONS_TYPE_SIMPLE Core NATS consumer
_NATS_CONS_TYPE_PUSH JetStream PUSH consumer
_NATS_CONS_TYPE_PULL JetStream PULL consumer

Options (I)

ALPHA(n)

List of options for subscribers in the form of a set of key/value pairs with the : character separating the key from the value and the ; character separating the options. NATS Core subscribers only accept the "queue" option.

The accepted options are:

name Consumer’s name.
stream Name of NATS stream.
durable Name of consumer durable.
bind Bind to an existing consumer (name must reference the consumer's name).
messageAlarmTime Wait time between two messages or heartbeats before triggering an error.
ordered Ordered message delivery (PUSH only)
deliverSubject Recipient subject (PUSH only).
deliverGroup

Group of recipients (PUSH only). Must match the queue parameters if both are specified.

pendingMessageLimit Maximum number of pending messages (PUSH only).
pendingByteLimit Maximum size of pending messages (PUSH only).
queue Queue to use (NATS Core or PUSH only).
fastBind Fast bind. The consumer parameter match is not validated (PULL only).
fetchSize

Size of batch to process (PULL only).

autoAck

Automatic message acknowledgment at the end of the process by onMessage if the ACKNOWLEDGE_MESSAGE method was not called by the program.


Possible values:

ack Acknowledges the message.
nak Reject the message (it will be re-issued).
term Terminate the message (it will not be re-issued).

This parameter is ignored in the case of a Core NATS subscriber.

ReturnCode (O)

NUM_BIN_4

Method's return code.

Cancels the subscription to a NATS subject.

Syntax

CALL_METHOD ObjectName UNSUBSCRIBE Subject ReturnCode

Parameters

Subject (I)

ALPHA(250)

NATS subject.

ReturnCode (O)

NUM_BIN_4

Method's return code.



↑ Top of page