mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
flag for sayhello publisher
This commit is contained in:
parent
b4a883bb4e
commit
8d245f372e
3 changed files with 7 additions and 7 deletions
|
@ -91,7 +91,7 @@ type Configuration struct {
|
|||
// default amount of retries that will be done before a message is thrown away, and out of the system
|
||||
DefaultMessageRetries int
|
||||
// Make the current node send hello messages to central at given interval in seconds
|
||||
PublisherServiceSayhello int
|
||||
StartPubSayHello int
|
||||
// Publisher data folder
|
||||
SubscribersDataFolder string
|
||||
// central node to receive messages published from nodes
|
||||
|
@ -131,7 +131,7 @@ func newConfigurationDefaults() Configuration {
|
|||
PromHostAndPort: "",
|
||||
DefaultMessageTimeout: 10,
|
||||
DefaultMessageRetries: 1,
|
||||
PublisherServiceSayhello: 30,
|
||||
StartPubSayHello: 30,
|
||||
SubscribersDataFolder: "./data",
|
||||
CentralNodeName: "",
|
||||
StartSubErrorLog: flagNodeSlice{Values: []node{}},
|
||||
|
@ -172,7 +172,7 @@ func (c *Configuration) CheckFlags() error {
|
|||
flag.StringVar(&c.SubscribersDataFolder, "subscribersDataFolder", fc.SubscribersDataFolder, "The data folder where subscribers are allowed to write their data if needed")
|
||||
flag.StringVar(&c.CentralNodeName, "centralNodeName", fc.CentralNodeName, "The name of the central node to receive messages published by this node")
|
||||
|
||||
flag.IntVar(&c.PublisherServiceSayhello, "publisherServiceSayhello", fc.PublisherServiceSayhello, "Make the current node send hello messages to central at given interval in seconds")
|
||||
flag.IntVar(&c.StartPubSayHello, "startPubSayHello", fc.StartPubSayHello, "Make the current node send hello messages to central at given interval in seconds")
|
||||
|
||||
flag.Var(&c.StartSubErrorLog, "startSubErrorLog", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||
flag.Var(&c.StartSubSayHello, "startSubSayHello", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||
|
|
|
@ -6,7 +6,7 @@ DefaultMessageTimeout = 5
|
|||
NodeName = "central"
|
||||
ProfilingPort = ""
|
||||
PromHostAndPort = ""
|
||||
PublisherServiceSayhello = 30
|
||||
StartPubSayhello = 0
|
||||
SubscribersDataFolder = "./data"
|
||||
|
||||
[StartSubCLICommand]
|
||||
|
|
|
@ -131,13 +131,13 @@ func (s *server) ProcessesStart() {
|
|||
// Define a process of kind publisher with subject for SayHello to central,
|
||||
// and register a procFunc with the process that will handle the actual
|
||||
// sending of say hello.
|
||||
if s.configuration.PublisherServiceSayhello != 0 {
|
||||
if s.configuration.StartPubSayHello != 0 {
|
||||
fmt.Printf("Starting SayHello Publisher: %#v\n", s.nodeName)
|
||||
|
||||
sub := newSubject(SayHello, EventNACK, s.configuration.CentralNodeName)
|
||||
proc := newProcess(s.processes, s.newMessagesCh, s.configuration, sub, s.errorKernel.errorCh, processKindPublisher, []node{}, nil)
|
||||
|
||||
// Define the procFun to be used for the process.
|
||||
// Define the procFunc to be used for the process.
|
||||
proc.procFunc = procFunc(
|
||||
func() error {
|
||||
for {
|
||||
|
@ -158,7 +158,7 @@ func (s *server) ProcessesStart() {
|
|||
log.Printf("error: ProcessesStart: %v\n", err)
|
||||
}
|
||||
proc.newMessagesCh <- []subjectAndMessage{sam}
|
||||
time.Sleep(time.Second * time.Duration(s.configuration.PublisherServiceSayhello))
|
||||
time.Sleep(time.Second * time.Duration(s.configuration.StartPubSayHello))
|
||||
}
|
||||
})
|
||||
go proc.spawnWorker(s)
|
||||
|
|
Loading…
Reference in a new issue