From d5082cc7a4104f773694d03792c52a814e23c0a0 Mon Sep 17 00:00:00 2001 From: postmannen Date: Thu, 16 Sep 2021 12:37:46 +0200 Subject: [PATCH] added replyMethodTimeout to message --- README.md | 8 +++++++- message_and_subject.go | 2 ++ requests.go | 12 +++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 80f318d..e691add 100644 --- a/README.md +++ b/README.md @@ -475,11 +475,15 @@ method // 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 // shell command to execute in a cli session. -MethodArgs []string `json:"methodArgs" yaml:"methodArgs"` +MethodArgs []string // 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. replyMethod +// 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 []string // Initial message Reply ACK wait timeout ACKTimeout // Normal Resend retries @@ -490,6 +494,8 @@ replyACKTimeout replyRetries // Timeout for long a process should be allowed to operate methodTimeout +// Timeout for long a process should be allowed to operate +ReplyMethodTimeout int // Directory is a string that can be used to create the //directory structure when saving the result of some method. // For example "syslog","metrics", or "metrics/mysensor" diff --git a/message_and_subject.go b/message_and_subject.go index 9012c3a..fd35a9d 100644 --- a/message_and_subject.go +++ b/message_and_subject.go @@ -52,6 +52,8 @@ type Message struct { ReplyRetries int `json:"replyRetries" yaml:"replyRetries"` // Timeout for long a process should be allowed to operate MethodTimeout int `json:"methodTimeout" yaml:"methodTimeout"` + // Timeout for long a process should be allowed to operate + ReplyMethodTimeout int `json:"replyMethodTimeout" yaml:"replyMethodTimeout"` // Directory is a string that can be used to create the //directory structure when saving the result of some method. // For example "syslog","metrics", or "metrics/mysensor" diff --git a/requests.go b/requests.go index 2a89032..07c06c1 100644 --- a/requests.go +++ b/requests.go @@ -271,11 +271,13 @@ func newReplyMessage(proc process, message Message, outData []byte) { // Create a new message for the reply, and put it on the // ringbuffer to be published. newMsg := Message{ - ToNode: message.FromNode, - Data: []string{string(outData)}, - Method: message.ReplyMethod, - ACKTimeout: message.ReplyACKTimeout, - Retries: message.ReplyRetries, + ToNode: message.FromNode, + Data: []string{string(outData)}, + Method: message.ReplyMethod, + MethodArgs: message.ReplyMethodArgs, + MethodTimeout: message.ReplyMethodTimeout, + ACKTimeout: message.ReplyACKTimeout, + Retries: message.ReplyRetries, // Put in a copy of the initial request message, so we can use it's properties if // needed to for example create the file structure naming on the subscriber.