mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-31 01:24:31 +00:00
Added flags and startup for OpCommand
This commit is contained in:
parent
fc04ea83bd
commit
6c3ac318dc
3 changed files with 15 additions and 5 deletions
|
@ -115,6 +115,8 @@ type Configuration struct {
|
|||
StartSubCLICommandRequestNOSEQ flagNodeSlice
|
||||
// Subscriber for CLICommandReply
|
||||
StartSubCLICommandReply flagNodeSlice
|
||||
// Subscriber for OpCommand
|
||||
StartSubOpCommand flagNodeSlice
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
|
@ -143,6 +145,7 @@ func newConfigurationDefaults() Configuration {
|
|||
StartSubCLICommandRequest: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||
StartSubCLICommandRequestNOSEQ: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||
StartSubCLICommandReply: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||
StartSubOpCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
@ -183,6 +186,7 @@ func (c *Configuration) CheckFlags() error {
|
|||
flag.Var(&c.StartSubCLICommandRequest, "startSubCLICommandRequest", "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.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.StartSubOpCommand, "startSubOpCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ SubscribersDataFolder = "./data"
|
|||
OK = true
|
||||
Values = ["*"]
|
||||
|
||||
[StartSubOpCommand]
|
||||
OK = false
|
||||
Values = []
|
||||
|
||||
[StartSubSayHello]
|
||||
OK = true
|
||||
Values = ["*"]
|
||||
|
|
|
@ -13,11 +13,13 @@ func (s *server) ProcessesStart() {
|
|||
// --- Subscriber services that can be started via flags
|
||||
|
||||
// Start a subscriber for OPCommand messages
|
||||
{
|
||||
fmt.Printf("Starting OpCommand subscriber: %#v\n", s.nodeName)
|
||||
sub := newSubject(OpCommand, CommandACK, s.nodeName)
|
||||
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, []node{"*"}, nil)
|
||||
go proc.spawnWorker(s)
|
||||
if s.configuration.StartSubOpCommand.OK {
|
||||
{
|
||||
fmt.Printf("Starting OpCommand subscriber: %#v\n", s.nodeName)
|
||||
sub := newSubject(OpCommand, CommandACK, s.nodeName)
|
||||
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubOpCommand.Values, nil)
|
||||
go proc.spawnWorker(s)
|
||||
}
|
||||
}
|
||||
|
||||
// Start a subscriber for CLICommand messages
|
||||
|
|
Loading…
Add table
Reference in a new issue