// Start method starts the run loop for the worker, listening for a quit channel in
// case we need to stop it
Start method starts the run loop for the worker, listening for a quit channel in
case we need to stop it
// Start method starts the run loop for the worker listening for a quit channel in // case we need to stop it
func (w Worker) Start() {
	go func() {
		for {
			log.Println("Register JobChannel into WorkerPool")
			w.WorkerPool <- w.JobChannel
			select {
			case job := <-w.JobChannel:
				if err := job.Payload.SendEmail(); err != nil {
					log.Printf("Error send email: %s", err.Error())
				}
			case <-w.quit:
				return
			}
		}
	}()
}
func ( w Worker ) Start ( ) { go func ( ) { for { log . Println ( " " ) w . WorkerPool <- w . JobChannel select { case job := <- w . JobChannel : if err := job . Payload . SendEmail ( ) ; err != nil { log . Printf ( " " , err . Error ( ) ) } case <- w . quit : return } } } ( ) }
Start method starts the run loop for the worker, listening for a quit channel in
case we need to stop it
Start method starts the run loop for the worker listening for a quit channel in case we need to stop it
// register the current worker into the worker queue. // we have received a work request. // we have received a signal to stop