Golang Client - using multiple goroutines ("threads") for handlers

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:

  1. 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.

  1. 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.

Here is some more Go client code to look at. The code may be out of date, but the patterns are there:

Hope there is something in there that helps.
Josh