github.com/Jeffail/benthos/v3@v3.65.0/lib/input/redis_list.go (about) 1 package input 2 3 import ( 4 "github.com/Jeffail/benthos/v3/internal/docs" 5 "github.com/Jeffail/benthos/v3/internal/impl/redis" 6 "github.com/Jeffail/benthos/v3/lib/input/reader" 7 "github.com/Jeffail/benthos/v3/lib/log" 8 "github.com/Jeffail/benthos/v3/lib/metrics" 9 "github.com/Jeffail/benthos/v3/lib/types" 10 ) 11 12 //------------------------------------------------------------------------------ 13 14 func init() { 15 Constructors[TypeRedisList] = TypeSpec{ 16 constructor: fromSimpleConstructor(NewRedisList), 17 Summary: ` 18 Pops messages from the beginning of a Redis list using the BLPop command.`, 19 FieldSpecs: redis.ConfigDocs().Add( 20 docs.FieldCommon("key", "The key of a list to read from."), 21 docs.FieldAdvanced("timeout", "The length of time to poll for new messages before reattempting."), 22 ), 23 Categories: []Category{ 24 CategoryServices, 25 }, 26 } 27 } 28 29 //------------------------------------------------------------------------------ 30 31 // NewRedisList creates a new Redis List input type. 32 func NewRedisList(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { 33 r, err := reader.NewRedisList(conf.RedisList, log, stats) 34 if err != nil { 35 return nil, err 36 } 37 return NewAsyncReader(TypeRedisList, true, reader.NewAsyncPreserver(r), log, stats) 38 } 39 40 //------------------------------------------------------------------------------