Hello Greetings,
I am a bit confused about the golang example:
jobWorker := zbClient.NewJobWorker().JobType("payment-service").Handler(handleJob).Open()
<-readyClose
jobWorker.Close()
jobWorker.AwaitClose()
especially in the handler
func handleJob(client worker.JobClient, job entities.Job) {
//...
log.Println("Successfully completed job")
close(readyClose)
Questions:
- Why is the channel closed? This stops the execution of the program. That doesn’t really make sense, as a handler should continue forever (or at last until a sighandler gets a stop signal).
Maybe that makes sense in the context of the example - but maybe clearly put some information about that - or provide a real world worker here.
- Do you guys have any example, where multiple handlers are started as goroutines? e.g. I want to have per proces 10 goroutines handling the same topic.
Thx.