github.com/Jeffail/benthos/v3@v3.65.0/lib/input/amqp_1.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/amqp/sasl"
    10  	"github.com/Jeffail/benthos/v3/lib/util/tls"
    11  )
    12  
    13  //------------------------------------------------------------------------------
    14  
    15  func init() {
    16  	Constructors[TypeAMQP1] = TypeSpec{
    17  		constructor: fromSimpleConstructor(NewAMQP1),
    18  		Status:      docs.StatusBeta,
    19  		Summary: `
    20  Reads messages from an AMQP (1.0) server.`,
    21  		Description: `
    22  ### Metadata
    23  
    24  This input adds the following metadata fields to each message:
    25  
    26  ` + "``` text" + `
    27  - amqp_content_type
    28  - amqp_content_encoding
    29  - amqp_creation_time
    30  - All string typed message annotations
    31  ` + "```" + `
    32  
    33  You can access these metadata fields using
    34  [function interpolation](/docs/configuration/interpolation#metadata).`,
    35  		Categories: []Category{
    36  			CategoryServices,
    37  		},
    38  		FieldSpecs: docs.FieldSpecs{
    39  			docs.FieldCommon("url",
    40  				"A URL to connect to.",
    41  				"amqp://localhost:5672/",
    42  				"amqps://guest:guest@localhost:5672/",
    43  			),
    44  			docs.FieldCommon("source_address", "The source address to consume from.", "/foo", "queue:/bar", "topic:/baz"),
    45  			docs.FieldAdvanced("azure_renew_lock", "Experimental: Azure service bus specific option to renew lock if processing takes more then configured lock time").AtVersion("3.45.0"),
    46  			tls.FieldSpec(),
    47  			sasl.FieldSpec(),
    48  		},
    49  	}
    50  }
    51  
    52  //------------------------------------------------------------------------------
    53  
    54  // NewAMQP1 creates a new AMQP1 input type.
    55  func NewAMQP1(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) {
    56  	var a reader.Async
    57  	var err error
    58  	if a, err = reader.NewAMQP1(conf.AMQP1, log, stats); err != nil {
    59  		return nil, err
    60  	}
    61  	a = reader.NewAsyncBundleUnacks(a)
    62  	return NewAsyncReader(TypeAMQP1, true, a, log, stats)
    63  }
    64  
    65  //------------------------------------------------------------------------------