1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

renamed CLICommandReply to REQTextToConsole

This commit is contained in:
postmannen 2021-04-05 07:27:39 +02:00
parent debd146f28
commit af06e47b7b
4 changed files with 34 additions and 34 deletions

View file

@ -112,8 +112,8 @@ type Configuration struct {
StartSubREQCliCommand flagNodeSlice StartSubREQCliCommand flagNodeSlice
// Subscriber for REQnCliCommand // Subscriber for REQnCliCommand
StartSubREQnCliCommand flagNodeSlice StartSubREQnCliCommand flagNodeSlice
// Subscriber for CLICommandReply // Subscriber for REQTextToConsole
StartSubCLICommandReply flagNodeSlice StartSubREQTextToConsole flagNodeSlice
} }
func NewConfiguration() *Configuration { func NewConfiguration() *Configuration {
@ -124,23 +124,23 @@ func NewConfiguration() *Configuration {
// Default configuration // Default configuration
func newConfigurationDefaults() Configuration { func newConfigurationDefaults() Configuration {
c := Configuration{ c := Configuration{
ConfigFolder: "./etc", ConfigFolder: "./etc",
BrokerAddress: "127.0.0.1:4222", BrokerAddress: "127.0.0.1:4222",
ProfilingPort: "", ProfilingPort: "",
PromHostAndPort: "", PromHostAndPort: "",
DefaultMessageTimeout: 10, DefaultMessageTimeout: 10,
DefaultMessageRetries: 1, DefaultMessageRetries: 1,
StartPubSayHello: 30, StartPubSayHello: 30,
SubscribersDataFolder: "./data", SubscribersDataFolder: "./data",
CentralNodeName: "", CentralNodeName: "",
StartSubErrorLog: flagNodeSlice{Values: []node{}}, StartSubErrorLog: flagNodeSlice{Values: []node{}},
StartSubSayHello: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubSayHello: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubTextLogging: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubTextLogging: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubCLICommandReply: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQTextToConsole: flagNodeSlice{OK: true, Values: []node{"*"}},
} }
return c 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.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.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.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() flag.Parse()

View file

@ -9,10 +9,6 @@ PromHostAndPort = ":2112"
StartPubSayHello = 0 StartPubSayHello = 0
SubscribersDataFolder = "./data" SubscribersDataFolder = "./data"
[StartSubCLICommandReply]
OK = true
Values = ["*"]
[StartSubEchoReply] [StartSubEchoReply]
OK = true OK = true
Values = ["*"] Values = ["*"]
@ -29,6 +25,10 @@ SubscribersDataFolder = "./data"
OK = true OK = true
Values = ["*"] Values = ["*"]
[StartSubREQTextToConsole]
OK = true
Values = ["*"]
[StartSubREQnCliCommand] [StartSubREQnCliCommand]
OK = true OK = true
Values = ["*"] Values = ["*"]

View file

@ -116,11 +116,11 @@ func (s *server) ProcessesStart() {
} }
// Start a subscriber for CLICommandReply messages // 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) fmt.Printf("Starting Text To Console subscriber: %#v\n", s.nodeName)
sub := newSubject(CLICommandReply, s.nodeName) sub := newSubject(REQTextToConsole, s.nodeName)
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubCLICommandReply.Values, nil) proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubREQTextToConsole.Values, nil)
go proc.spawnWorker(s) go proc.spawnWorker(s)
} }
} }

View file

@ -80,7 +80,7 @@ const (
// start up for receiving the CLICommand request messages. // start up for receiving the CLICommand request messages.
// The data field is a slice of strings where the first string // The data field is a slice of strings where the first string
// value should be the command, and the following the arguments. // value should be the command, and the following the arguments.
CLICommandReply Method = "CLICommandReply" REQTextToConsole Method = "REQTextToConsole"
// Send text logging to some host. // Send text logging to some host.
// A file with the full subject+hostName will be created on // A file with the full subject+hostName will be created on
// the receiving end. // the receiving end.
@ -122,7 +122,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
REQnCliCommand: methodREQnCliCommand{ REQnCliCommand: methodREQnCliCommand{
commandOrEvent: CommandACK, commandOrEvent: CommandACK,
}, },
CLICommandReply: methodCLICommandReply{ REQTextToConsole: methodREQTextToConsole{
commandOrEvent: EventACK, commandOrEvent: EventACK,
}, },
TextLogging: methodTextLogging{ 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 // Prepare and queue for sending a new message with the output
// of the action executed. // 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 commandOrEvent CommandOrEvent
} }
func (m methodCLICommandReply) getKind() CommandOrEvent { func (m methodREQTextToConsole) getKind() CommandOrEvent {
return m.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) fmt.Printf("<--- methodCLICommandReply: %v\n", message.Data)
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID)) ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))