github.com/Jeffail/benthos/v3@v3.65.0/lib/input/amqp.go (about) 1 package input 2 3 import ( 4 "github.com/Jeffail/benthos/v3/internal/docs" 5 "github.com/Jeffail/benthos/v3/lib/input/reader" 6 "github.com/Jeffail/benthos/v3/lib/log" 7 "github.com/Jeffail/benthos/v3/lib/metrics" 8 "github.com/Jeffail/benthos/v3/lib/types" 9 "github.com/Jeffail/benthos/v3/lib/util/tls" 10 ) 11 12 //------------------------------------------------------------------------------ 13 14 func init() { 15 Constructors[TypeAMQP] = TypeSpec{ 16 constructor: fromSimpleConstructor(NewAMQP), 17 Description: ` 18 DEPRECATED: This input is deprecated and scheduled for removal in Benthos V4. 19 Please use [` + "`amqp_0_9`" + `](/docs/components/inputs/amqp_0_9) instead.`, 20 Status: docs.StatusDeprecated, 21 FieldSpecs: docs.FieldSpecs{ 22 docs.FieldCommon("url", 23 "A URL to connect to.", 24 "amqp://localhost:5672/", 25 "amqps://guest:guest@localhost:5672/", 26 ), 27 docs.FieldCommon("queue", "An AMQP queue to consume from."), 28 docs.FieldAdvanced("queue_declare", ` 29 Allows you to passively declare the target queue. If the queue already exists 30 then the declaration passively verifies that they match the target fields.`, 31 ).WithChildren( 32 docs.FieldAdvanced("enabled", "Whether to enable queue declaration.").HasDefault(false), 33 docs.FieldAdvanced("durable", "Whether the declared queue is durable.").HasDefault(false), 34 ), 35 docs.FieldAdvanced("bindings_declare", 36 "Allows you to passively declare bindings for the target queue.", 37 []interface{}{ 38 map[string]interface{}{ 39 "exchange": "foo", 40 "key": "bar", 41 }, 42 }, 43 ).Array().WithChildren( 44 docs.FieldString("exchange", "The exchange of the declared binding.").HasDefault(""), 45 docs.FieldString("key", "The key of the declared binding.").HasDefault(""), 46 ), 47 docs.FieldDeprecated("max_batch_count"), 48 docs.FieldCommon("consumer_tag", "A consumer tag."), 49 docs.FieldCommon("prefetch_count", "The maximum number of pending messages to have consumed at a time."), 50 docs.FieldAdvanced("prefetch_size", "The maximum amount of pending messages measured in bytes to have consumed at a time."), 51 tls.FieldSpec(), 52 }, 53 } 54 } 55 56 //------------------------------------------------------------------------------ 57 58 // NewAMQP creates a new AMQP input type. 59 // TODO: V4 Remove this. 60 func NewAMQP(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { 61 log.Warnln("The amqp input is deprecated, please use amqp_0_9 instead.") 62 a, err := reader.NewAMQP(conf.AMQP, log, stats) 63 if err != nil { 64 return nil, err 65 } 66 return NewReader("amqp", a, log, stats) 67 } 68 69 //------------------------------------------------------------------------------