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