func (t *OutputConfig) nsqbackgroundtask() {
	for {
		select {
		case <-t.ctx.Done():
			goglog.Logger.Debug("outputnsq: stopping")
			t.producer.Stop()
			goglog.Logger.Debug("outputnsq: stopped")
			close(t.msg)
			return
		case msg := <-t.msg:
			err := t.producer.Publish(t.Topic, msg)
			if err != nil {
				err = t.queue.Queue(t.ctx, msg)
				if err != nil {
					goglog.Logger.Errorf("outputnsq: %s", err.Error())
				}
			} else {
				_ = t.queue.Resume(t.ctx)
			}
		}
	}
}
// nsqbackgroundtask runs in the background and handles messages and termination
nsqbackgroundtask runs in the background and handles messages and termination
// nsqbackgroundtask runs in the background and handles messages and termination
func (t *OutputConfig) nsqbackgroundtask() {
	for {
		select {
		case <-t.ctx.Done():
			goglog.Logger.Debug("outputnsq: stopping")
			t.producer.Stop()
			goglog.Logger.Debug("outputnsq: stopped")
			close(t.msg)
			return
		case msg := <-t.msg:
			err := t.producer.Publish(t.Topic, msg)
			if err != nil {
				err = t.queue.Queue(t.ctx, msg)
				if err != nil {
					goglog.Logger.Errorf("outputnsq: %s", err.Error())
				}
			} else {
				_ = t.queue.Resume(t.ctx)
			}
		}
	}
}
func ( t * OutputConfig ) nsqbackgroundtask ( ) { for { select { case <- t . ctx . Done ( ) : goglog . Logger . Debug ( " " ) t . producer . Stop ( ) goglog . Logger . Debug ( " " ) close ( t . msg ) return case msg := <- t . msg : err := t . producer . Publish ( t . Topic , msg ) if err != nil { err = t . queue . Queue ( t . ctx , msg ) if err != nil { goglog . Logger . Errorf ( " " , err . Error ( ) ) } } else { _ = t . queue . Resume ( t . ctx ) } } } }
nsqbackgroundtask runs in the background and handles messages and termination
nsqbackgroundtask runs in the background and handles messages and termination