func applyProcessorOptions()

in v2/processor.go [85:112]


func applyProcessorOptions(options *ProcessorOptions) *ProcessorOptions {
	opts := &ProcessorOptions{
		MaxConcurrency:          1,
		MaxReceiveCount:         1,
		ReceiveInterval:         to.Ptr(1 * time.Second),
		StartMaxAttempt:         1,
		StartRetryDelayStrategy: &ConstantDelayStrategy{Delay: 5 * time.Second},
	}
	if options != nil {
		if options.ReceiveInterval != nil {
			opts.ReceiveInterval = options.ReceiveInterval
		}
		if options.MaxConcurrency > 0 {
			opts.MaxConcurrency = options.MaxConcurrency
			opts.MaxReceiveCount = options.MaxConcurrency
		}
		if options.MaxReceiveCount > 0 && options.MaxReceiveCount < opts.MaxConcurrency {
			opts.MaxReceiveCount = options.MaxReceiveCount
		}
		if options.StartMaxAttempt > 0 {
			opts.StartMaxAttempt = options.StartMaxAttempt
		}
		if options.StartRetryDelayStrategy != nil {
			opts.StartRetryDelayStrategy = options.StartRetryDelayStrategy
		}
	}
	return opts
}