From af06e47b7bb48ad152450ee451dd9a23036538a6 Mon Sep 17 00:00:00 2001 From: postmannen Date: Mon, 5 Apr 2021 07:27:39 +0200 Subject: [PATCH] renamed CLICommandReply to REQTextToConsole --- configuration_flags.go | 40 +++++++++++++++++++------------------- etc/config.toml | 8 ++++---- startup_processes.go | 8 ++++---- subscriber_method_types.go | 12 ++++++------ 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/configuration_flags.go b/configuration_flags.go index d517811..7e01c6e 100644 --- a/configuration_flags.go +++ b/configuration_flags.go @@ -112,8 +112,8 @@ type Configuration struct { StartSubREQCliCommand flagNodeSlice // Subscriber for REQnCliCommand StartSubREQnCliCommand flagNodeSlice - // Subscriber for CLICommandReply - StartSubCLICommandReply flagNodeSlice + // Subscriber for REQTextToConsole + StartSubREQTextToConsole flagNodeSlice } func NewConfiguration() *Configuration { @@ -124,23 +124,23 @@ func NewConfiguration() *Configuration { // Default configuration func newConfigurationDefaults() Configuration { c := Configuration{ - ConfigFolder: "./etc", - BrokerAddress: "127.0.0.1:4222", - ProfilingPort: "", - PromHostAndPort: "", - DefaultMessageTimeout: 10, - DefaultMessageRetries: 1, - StartPubSayHello: 30, - SubscribersDataFolder: "./data", - CentralNodeName: "", - StartSubErrorLog: flagNodeSlice{Values: []node{}}, - StartSubSayHello: flagNodeSlice{OK: true, Values: []node{"*"}}, - StartSubTextLogging: flagNodeSlice{OK: true, Values: []node{"*"}}, - StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}}, - StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}}, - StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}}, - StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}}, - StartSubCLICommandReply: flagNodeSlice{OK: true, Values: []node{"*"}}, + ConfigFolder: "./etc", + BrokerAddress: "127.0.0.1:4222", + ProfilingPort: "", + PromHostAndPort: "", + DefaultMessageTimeout: 10, + DefaultMessageRetries: 1, + StartPubSayHello: 30, + SubscribersDataFolder: "./data", + CentralNodeName: "", + StartSubErrorLog: flagNodeSlice{Values: []node{}}, + StartSubSayHello: flagNodeSlice{OK: true, Values: []node{"*"}}, + StartSubTextLogging: flagNodeSlice{OK: true, Values: []node{"*"}}, + StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}}, + StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}}, + StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}}, + StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}}, + StartSubREQTextToConsole: flagNodeSlice{OK: true, Values: []node{"*"}}, } return c } @@ -179,7 +179,7 @@ func (c *Configuration) CheckFlags() error { flag.Var(&c.StartSubEchoReply, "startSubEchoReply", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQCliCommand, "startSubREQCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQnCliCommand, "startSubREQnCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") - flag.Var(&c.StartSubCLICommandReply, "startSubCLICommandReply", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") + flag.Var(&c.StartSubREQTextToConsole, "startSubREQTextToConsole", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Parse() diff --git a/etc/config.toml b/etc/config.toml index 4a059f4..cf33fa3 100644 --- a/etc/config.toml +++ b/etc/config.toml @@ -9,10 +9,6 @@ PromHostAndPort = ":2112" StartPubSayHello = 0 SubscribersDataFolder = "./data" -[StartSubCLICommandReply] - OK = true - Values = ["*"] - [StartSubEchoReply] OK = true Values = ["*"] @@ -29,6 +25,10 @@ SubscribersDataFolder = "./data" OK = true Values = ["*"] +[StartSubREQTextToConsole] + OK = true + Values = ["*"] + [StartSubREQnCliCommand] OK = true Values = ["*"] diff --git a/startup_processes.go b/startup_processes.go index c92ac4d..91edc6c 100644 --- a/startup_processes.go +++ b/startup_processes.go @@ -116,11 +116,11 @@ func (s *server) ProcessesStart() { } // Start a subscriber for CLICommandReply messages - if s.configuration.StartSubCLICommandReply.OK { + if s.configuration.StartSubREQTextToConsole.OK { { - fmt.Printf("Starting CLICommand Reply subscriber: %#v\n", s.nodeName) - sub := newSubject(CLICommandReply, s.nodeName) - proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubCLICommandReply.Values, nil) + fmt.Printf("Starting Text To Console subscriber: %#v\n", s.nodeName) + sub := newSubject(REQTextToConsole, s.nodeName) + proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubREQTextToConsole.Values, nil) go proc.spawnWorker(s) } } diff --git a/subscriber_method_types.go b/subscriber_method_types.go index 3196193..86cee2b 100644 --- a/subscriber_method_types.go +++ b/subscriber_method_types.go @@ -80,7 +80,7 @@ const ( // start up for receiving the CLICommand request messages. // The data field is a slice of strings where the first string // value should be the command, and the following the arguments. - CLICommandReply Method = "CLICommandReply" + REQTextToConsole Method = "REQTextToConsole" // Send text logging to some host. // A file with the full subject+hostName will be created on // the receiving end. @@ -122,7 +122,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable { REQnCliCommand: methodREQnCliCommand{ commandOrEvent: CommandACK, }, - CLICommandReply: methodCLICommandReply{ + REQTextToConsole: methodREQTextToConsole{ commandOrEvent: EventACK, }, TextLogging: methodTextLogging{ @@ -495,7 +495,7 @@ func (m methodREQnCliCommand) handler(proc process, message Message, node string // Prepare and queue for sending a new message with the output // of the action executed. - newReplyMessage(proc, message, CLICommandReply, out) + newReplyMessage(proc, message, REQTextToConsole, out) } }() @@ -506,15 +506,15 @@ func (m methodREQnCliCommand) handler(proc process, message Message, node string // --- -type methodCLICommandReply struct { +type methodREQTextToConsole struct { commandOrEvent CommandOrEvent } -func (m methodCLICommandReply) getKind() CommandOrEvent { +func (m methodREQTextToConsole) getKind() CommandOrEvent { return m.commandOrEvent } -func (m methodCLICommandReply) handler(proc process, message Message, node string) ([]byte, error) { +func (m methodREQTextToConsole) handler(proc process, message Message, node string) ([]byte, error) { fmt.Printf("<--- methodCLICommandReply: %v\n", message.Data) ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))