diff --git a/configuration_flags.go b/configuration_flags.go index 20137e6..d517811 100644 --- a/configuration_flags.go +++ b/configuration_flags.go @@ -96,6 +96,7 @@ type Configuration struct { SubscribersDataFolder string // central node to receive messages published from nodes CentralNodeName string + // Start the central error logger. // Takes a comma separated string of nodes to receive from or "*" for all nodes. StartSubErrorLog flagNodeSlice @@ -109,8 +110,8 @@ type Configuration struct { StartSubEchoReply flagNodeSlice // Subscriber for CLICommandRequest StartSubREQCliCommand flagNodeSlice - // Subscriber for CLICommandRequestNOSEQ - StartSubCLICommandRequestNOSEQ flagNodeSlice + // Subscriber for REQnCliCommand + StartSubREQnCliCommand flagNodeSlice // Subscriber for CLICommandReply StartSubCLICommandReply flagNodeSlice } @@ -123,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{"*"}}, - StartSubCLICommandRequestNOSEQ: 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{"*"}}, + StartSubCLICommandReply: flagNodeSlice{OK: true, Values: []node{"*"}}, } return c } @@ -177,7 +178,7 @@ func (c *Configuration) CheckFlags() error { flag.Var(&c.StartSubEchoRequest, "startSubEchoRequest", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") 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.StartSubCLICommandRequestNOSEQ, "startSubCLICommandRequestNOSEQ", "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.Parse() diff --git a/etc/config.toml b/etc/config.toml index e7088ce..4a059f4 100644 --- a/etc/config.toml +++ b/etc/config.toml @@ -13,10 +13,6 @@ SubscribersDataFolder = "./data" OK = true Values = ["*"] -[StartSubCLICommandRequestNOSEQ] - OK = true - Values = ["*"] - [StartSubEchoReply] OK = true Values = ["*"] @@ -33,6 +29,10 @@ SubscribersDataFolder = "./data" OK = true Values = ["*"] +[StartSubREQnCliCommand] + OK = true + Values = ["*"] + [StartSubSayHello] OK = true Values = ["*"] diff --git a/example/toShip1-CLICommandRequest1.json b/example/toShip1-REQCliCommand.json similarity index 100% rename from example/toShip1-CLICommandRequest1.json rename to example/toShip1-REQCliCommand.json diff --git a/example/toShip1-OpCommandRequest.json b/example/toShip1-REQOpCommand.json similarity index 100% rename from example/toShip1-OpCommandRequest.json rename to example/toShip1-REQOpCommand.json diff --git a/example/toShip1-CLICommandRequest2.json b/example/toShip1-REQnCliCommand.json similarity index 55% rename from example/toShip1-CLICommandRequest2.json rename to example/toShip1-REQnCliCommand.json index 4de58e9..b949562 100644 --- a/example/toShip1-CLICommandRequest2.json +++ b/example/toShip1-REQnCliCommand.json @@ -3,9 +3,9 @@ "toNode": "ship1", "data": ["bash","-c","tree ../"], - "method":"CLICommandRequestNOSEQ", - "timeout":10, + "method":"REQnCliCommand", + "timeout":3, "retries":3, - "methodTimeout": 0 + "methodTimeout": 10 } ] \ No newline at end of file diff --git a/startup_processes.go b/startup_processes.go index a3c8b7c..c92ac4d 100644 --- a/startup_processes.go +++ b/startup_processes.go @@ -105,12 +105,12 @@ func (s *server) ProcessesStart() { } } - // Start a subscriber for CLICommandRequestNOSEQ messages - if s.configuration.StartSubCLICommandRequestNOSEQ.OK { + // Start a subscriber for Not In Order Cli Command Request messages + if s.configuration.StartSubREQnCliCommand.OK { { - fmt.Printf("Starting CLICommand NOSEQ Request subscriber: %#v\n", s.nodeName) - sub := newSubject(CLICommandRequestNOSEQ, s.nodeName) - proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubCLICommandRequestNOSEQ.Values, nil) + fmt.Printf("Starting CLICommand Not Sequential Request subscriber: %#v\n", s.nodeName) + sub := newSubject(REQnCliCommand, s.nodeName) + proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubREQnCliCommand.Values, nil) go proc.spawnWorker(s) } } diff --git a/subscriber_method_types.go b/subscriber_method_types.go index b9253d5..3196193 100644 --- a/subscriber_method_types.go +++ b/subscriber_method_types.go @@ -72,7 +72,7 @@ const ( // done. No order are preserved. // The data field is a slice of strings where the first string // value should be the command, and the following the arguments. - CLICommandRequestNOSEQ Method = "CLICommandRequestNOSEQ" + REQnCliCommand Method = "REQnCliCommand" // Will generate a reply for a CLICommandRequest. // This type is normally not used by the user when creating // a message. It is used in creating the reply message with @@ -119,7 +119,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable { REQCliCommand: methodREQCliCommand{ commandOrEvent: CommandACK, }, - CLICommandRequestNOSEQ: methodCLICommandRequestNOSEQ{ + REQnCliCommand: methodREQnCliCommand{ commandOrEvent: CommandACK, }, CLICommandReply: methodCLICommandReply{ @@ -447,11 +447,11 @@ func (m methodREQCliCommand) handler(proc process, message Message, node string) // --- methodCLICommandRequestNOSEQ -type methodCLICommandRequestNOSEQ struct { +type methodREQnCliCommand struct { commandOrEvent CommandOrEvent } -func (m methodCLICommandRequestNOSEQ) getKind() CommandOrEvent { +func (m methodREQnCliCommand) getKind() CommandOrEvent { return m.commandOrEvent } @@ -461,7 +461,7 @@ func (m methodCLICommandRequestNOSEQ) getKind() CommandOrEvent { // The NOSEQ method will process messages as they are recived, // and the reply back will be sent as soon as the process is // done. No order are preserved. -func (m methodCLICommandRequestNOSEQ) handler(proc process, message Message, node string) ([]byte, error) { +func (m methodREQnCliCommand) handler(proc process, message Message, node string) ([]byte, error) { log.Printf("<--- CLICommand REQUEST received from: %v, containing: %v", message.FromNode, message.Data) // Execute the CLI command in it's own go routine, so we are able