1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-03-31 01:24:31 +00:00

created a separate method for helloPublisher

This commit is contained in:
postmannen 2024-12-02 05:07:24 +01:00
parent a83029c343
commit b564e3ebef
3 changed files with 7 additions and 7 deletions

View file

@ -82,7 +82,7 @@ type process struct {
// handler is used to directly attach a handler to a process upon
// creation of the process, like when a process is spawning a sub
// process like REQCopySrc do. If we're not spawning a sub process
// process like copySrc do. If we're not spawning a sub process
// and it is a regular process the handler to use is found with the
// getHandler method
handler func(proc process, message Message, node string) ([]byte, error)

View file

@ -166,9 +166,7 @@ func (p *processes) Start(proc process) {
if proc.configuration.StartProcesses.StartPubHello != 0 {
pf := func(ctx context.Context, procFuncCh chan Message) error {
fmt.Println("\n-------------------------------------------------------------------------------------------")
fmt.Printf("--- starting up publisher for method %v\n", "hello")
fmt.Print("-------------------------------------------------------------------------------------------\n\n")
ticker := time.NewTicker(time.Second * time.Duration(p.configuration.StartProcesses.StartPubHello))
defer ticker.Stop()
for {
@ -200,7 +198,7 @@ func (p *processes) Start(proc process) {
}
}
}
proc.startup.subscriber(proc, Hello, pf)
proc.startup.subscriber(proc, HelloPublisher, pf)
}
if proc.configuration.StartProcesses.EnableKeyUpdates {

View file

@ -104,8 +104,9 @@ const (
SUBCopySrc Method = "subCopySrc"
// Write the destination copied to some node.
SUBCopyDst Method = "subCopyDst"
// Send Hello I'm here message.
Hello Method = "hello"
// Hello I'm here message.
Hello Method = "hello"
HelloPublisher Method = "helloPublisher"
// Error log methods to centralError node.
ErrorLog Method = "errorLog"
// Http Get
@ -187,6 +188,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
SUBCopySrc: HandlerFunc(methodSUB),
SUBCopyDst: HandlerFunc(methodSUB),
Hello: HandlerFunc(methodHello),
HelloPublisher: HandlerFunc(nil),
ErrorLog: HandlerFunc(methodErrorLog),
HttpGet: HandlerFunc(methodHttpGet),
HttpGetScheduled: HandlerFunc(methodHttpGetScheduled),