github.com/Jeffail/benthos/v3@v3.65.0/lib/output/tcp.go (about)

     1  package output
     2  
     3  import (
     4  	"github.com/Jeffail/benthos/v3/internal/docs"
     5  	"github.com/Jeffail/benthos/v3/lib/log"
     6  	"github.com/Jeffail/benthos/v3/lib/metrics"
     7  	"github.com/Jeffail/benthos/v3/lib/output/writer"
     8  	"github.com/Jeffail/benthos/v3/lib/types"
     9  )
    10  
    11  //------------------------------------------------------------------------------
    12  
    13  func init() {
    14  	Constructors[TypeTCP] = TypeSpec{
    15  		constructor: fromSimpleConstructor(NewTCP),
    16  		Description: `
    17  Sends messages as a continuous stream of line delimited data over TCP by
    18  connecting to a server.
    19  
    20  If batched messages are sent the final message of the batch will be followed by
    21  two line breaks in order to indicate the end of the batch.`,
    22  		Status: docs.StatusDeprecated,
    23  		FieldSpecs: docs.FieldSpecs{
    24  			docs.FieldCommon("address", ""),
    25  		},
    26  	}
    27  }
    28  
    29  // NewTCP creates a new TCP output type.
    30  func NewTCP(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) {
    31  	log.Warnln("The tcp output is deprecated, please use socket instead.")
    32  	t, err := writer.NewTCP(conf.TCP, mgr, log, stats)
    33  	if err != nil {
    34  		return nil, err
    35  	}
    36  	return NewWriter(TypeTCP, t, log, stats)
    37  }
    38  
    39  //------------------------------------------------------------------------------