func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeOutputConfig, error) {
	conf := DefaultOutputConfig()
	err := config.ReflectConfig(raw, &conf)
	if err != nil {
		return nil, err
	}

	if len(conf.NSQ) == 0 {
		return nil, errors.New("Missing NSQ server")
	}
	if len(conf.Topic) == 0 {
		return nil, errors.New("Missing topic")
	}

	conf.Codec, err = config.GetCodecOrDefault(ctx, raw["codec"])
	if err != nil {
		return nil, err
	}

	conf.ctx = ctx
	cfg := nsq.NewConfig()
	cfg.MaxInFlight = int(conf.InFlight)
	cfg.UserAgent = "gogstash/" + version.VERSION
	conf.producer, err = nsq.NewProducer(conf.NSQ, cfg)
	if err != nil {
		return nil, err
	}
	conf.queue = queue.NewSimpleQueue(ctx, control, &conf, conf.msg, 10, 30) // last values are queue size and retry interval in seconds
	go conf.nsqbackgroundtask()
	return conf.queue, nil
}
// InitHandler initialize the output plugin
InitHandler initialize the output plugin
// InitHandler initialize the output plugin
func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeOutputConfig, error) {
	conf := DefaultOutputConfig()
	err := config.ReflectConfig(raw, &conf)
	if err != nil {
		return nil, err
	}
	if len(conf.NSQ) == 0 {
		return nil, errors.New("Missing NSQ server")
	}
	if len(conf.Topic) == 0 {
		return nil, errors.New("Missing topic")
	}
	conf.Codec, err = config.GetCodecOrDefault(ctx, raw["codec"])
	if err != nil {
		return nil, err
	}
	conf.ctx = ctx
	cfg := nsq.NewConfig()
	cfg.MaxInFlight = int(conf.InFlight)
	cfg.UserAgent = "gogstash/" + version.VERSION
	conf.producer, err = nsq.NewProducer(conf.NSQ, cfg)
	if err != nil {
		return nil, err
	}
	conf.queue = queue.NewSimpleQueue(ctx, control, &conf, conf.msg, 10, 30) 
	go conf.nsqbackgroundtask()
	return conf.queue, nil
}
func InitHandler ( ctx context . Context , raw config . ConfigRaw , control config . Control , ) ( config . TypeOutputConfig , error ) { conf := DefaultOutputConfig ( ) err := config . ReflectConfig ( raw , & conf ) if err != nil { return nil , err } if len ( conf . NSQ ) == 0 { return nil , errors . New ( " " ) } if len ( conf . Topic ) == 0 { return nil , errors . New ( " " ) } conf . Codec , err = config . GetCodecOrDefault ( ctx , raw [ " " ] ) if err != nil { return nil , err } conf . ctx = ctx cfg := nsq . NewConfig ( ) cfg . MaxInFlight = int ( conf . InFlight ) cfg . UserAgent = " " + version . VERSION conf . producer , err = nsq . NewProducer ( conf . NSQ , cfg ) if err != nil { return nil , err } conf . queue = queue . NewSimpleQueue ( ctx , control , & conf , conf . msg , 10 , 30 ) go conf . nsqbackgroundtask ( ) return conf . queue , nil }
InitHandler initialize the output plugin
InitHandler initialize the output plugin
// last values are queue size and retry interval in seconds