github.com/Jeffail/benthos/v3@v3.65.0/lib/input/sqs.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/aws/session" 10 ) 11 12 //------------------------------------------------------------------------------ 13 14 func init() { 15 Constructors[TypeSQS] = TypeSpec{ 16 constructor: fromSimpleConstructor(NewAmazonSQS), 17 Status: docs.StatusDeprecated, 18 Summary: ` 19 Receive messages from an Amazon SQS URL.`, 20 Description: ` 21 ## Alternatives 22 23 This input is being replaced with the shiny new ` + "[`aws_sqs` input](/docs/components/inputs/aws_sqs)" + `, which has improved features, consider trying it out instead. 24 25 ### Credentials 26 27 By default Benthos will use a shared credentials file when connecting to AWS 28 services. It's also possible to set them explicitly at the component level, 29 allowing you to transfer data across accounts. You can find out more 30 [in this document](/docs/guides/cloud/aws). 31 32 ### Metadata 33 34 This input adds the following metadata fields to each message: 35 36 ` + "```text" + ` 37 - sqs_message_id 38 - sqs_receipt_handle 39 - sqs_approximate_receive_count 40 - All message attributes 41 ` + "```" + ` 42 43 You can access these metadata fields using 44 [function interpolation](/docs/configuration/interpolation#metadata).`, 45 FieldSpecs: append( 46 append(docs.FieldSpecs{ 47 docs.FieldCommon("url", "The SQS URL to consume from."), 48 docs.FieldAdvanced("delete_message", "Whether to delete the consumed message once it is acked. Disabling allows you to handle the deletion using a different mechanism."), 49 }, session.FieldSpecs()...), 50 docs.FieldAdvanced("timeout", "The period of time to wait before abandoning a request and trying again."), 51 docs.FieldAdvanced("max_number_of_messages", "The maximum number of messages to consume from each request."), 52 ), 53 Categories: []Category{ 54 CategoryServices, 55 CategoryAWS, 56 }, 57 } 58 } 59 60 //------------------------------------------------------------------------------ 61 62 // NewAmazonSQS creates a new AWS SQS input type. 63 func NewAmazonSQS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { 64 s, err := reader.NewAmazonSQS(conf.SQS, log, stats) 65 if err != nil { 66 return nil, err 67 } 68 return NewAsyncReader(TypeSQS, true, reader.NewAsyncBundleUnacks(s), log, stats) 69 } 70 71 //------------------------------------------------------------------------------