Message fields
Schema for the message structure to use with ctrl
Field Name | Value Type | Description |
---|---|---|
toNode | string | A single node to send a message to |
toNodes | string array | A comma separated list of nodes to send a message to |
jetstreamToNode | string array | JetstreamToNode, the topic used to prefix the stream name with the format NODES.<JetstreamToNode> |
method | string | The request method to use |
methodArgs | string array | The arguments to use for the method |
replyMethod | string | The method to use for the reply message |
replyMethodArgs | string array | The arguments to use for the reply method |
ACKTimeout | int | The time to wait for a received acknowledge (ACK). 0 for no acknowledge |
retries | int | The number of times to retry if no ACK was received |
replyACKTimeout | int | The timeout to wait for an ACK message before we retry |
replyRetries | int | The number of times to retry if no ACK was received for repply messages |
methodTimeout | int | The timeout in seconds for how long we wait for a method to complete |
replyMethodTimeout | int | The timeout in seconds for how long we wait for a method to complete for repply messages |
directory | string | The directory for where to store the data of the repply message |
fileName | string | The name of the file for where we store the data of the reply message |
schedule | [int type value for interval in seconds, int type value for total run time in seconds] | Schedule a message to re run at interval |
More detailed description of the fields
toNode : "some-node"
The node to send the message to.
toNodes : node1,node2
ToNodes to specify several hosts to send message to in the form of an slice/array. When used, the message will be split up into one message for each node specified, so the sending to each node will be handled individually.
data : data here in byte format
The actual data in the message. This is the field where we put the returned data in a reply message. The data field are of type []byte.
method : cliCommand
What request method type to use, like cliCommand, httpGet, all methods.
methodArgs :
- "bash"
- "-c"
- |
echo "this is a test"
echo "and some other test"
Additional arguments that might be needed when executing the method. Can be f.ex. an ip address if it is a tcp sender, or the actual shell command to execute in a cli.
replyMethod : file
ReplyMethod, is the method to use for the reply message. By default the reply method will be set to log to file, but you can override it setting your own here.
methodArgs :
- "bash"
- "-c"
- |
echo "this is a test"
Additional arguments that might be needed when executing the reply method. Can be f.ex. an ip address if it is a tcp sender, or the shell command to execute in a cli session. replyMethodArgs :
fromNode Node : "node2"
From what node the message originated. This field is automatically filled by ctrl when left blanc, so that when a message are sent from a node the user don't have to worry about getting eventual repply messages back. Setting a
ACKTimeout: 10
ACKTimeout for waiting for an Ack message in seconds.
If the ACKTimeout value is set to 0 the message will become an No Ack message. With No Ack messages we will not wait for an Ack, nor will the receiver send an Ack, and we will never try to resend a message.
retryWait : 60
RetryWait specifies the time in seconds to wait between retries. This value is added to the ACKTimeout and to make the total time before retrying to sending a message. A usecase can be when you want a low ACKTimeout, but you want to add more time between the retries to avoid spamming the receiving node.
retries : 3
How many times we should try to resend the message if no ACK was received.
replyACKTimeout int `json:"replyACKTimeout" yaml:"replyACKTimeout"`
The ACK timeout used with reply messages. If not specified the value of ACKTimeout
will be used.
replyRetries int `json:"replyRetries" yaml:"replyRetries"`
The number of retries for trying to resend a message for reply messages.
methodTimeout : 10
Timeout for how long a method should be allowed to run before it is timed out.
If methodTimeout : -1
the method will not time out.
replyMethodTimeout : 10
Timeout for how long a method should be allowed to run before it is timed out, but for the reply message.
directory string `json:"directory" yaml:"directory"`
Specify the directory structure to use when saving the result data for a repply message.
- When the values are comma separated like
"syslog","metrics"
a syslog folder with a subfolder metrics will be created in the directory specified with startup env variableSUBSCRIBER_DATA_FOLDER
. - Absolute paths can also be used if you want to save the result somewhere else on the system, like "/etc/myservice".
fileName : myfile.conf
The fileName field are used together with the directory field mentioned earlier to create a full path for where to write the resulting data of a repply message.
schedule : [2,5]
Schedule are used for scheduling the method of messages to be executed several times. The schedule is defined as an array of two values, where the first value defines how often the schedule should trigger a run in seconds, and the second value is for how long the schedule are allowed to run in seconds total. [2,5]
will trigger the method to be executed again every 2 seconds, but when a total time of 5 seconds have passed it will stop scheduling.