socket
Connects to a (tcp/udp/unix) server and sends a continuous stream of data, dividing messages according to the specified codec.
# Config fields, showing default valuesoutput:label: ""socket:network: ""address: ""codec: lines
Batches and Multipart Messages​
When writing multipart (batched) messages using the lines codec the last message ends with double delimiters. E.g. the messages "foo", "bar" and "baz" would be written as:
foo\nbar\nbaz\n
Whereas a multipart message [ "foo", "bar", "baz" ] would be written as:
foo\nbar\nbaz\n\n
This enables consumers of this output feed to reconstruct the original batches. However, if you wish to avoid this behaviour then add a split processor before messages reach this output.
Fields​
network​
The network type to connect as.
Type: string
Default: ""
Options: unix, tcp, udp.
address​
The address (or path) to connect to.
Type: string
Default: ""
# Examplesaddress: /tmp/benthos.sockaddress: localhost:9000
codec​
The way in which the bytes of messages should be written out into the output data stream. It's possible to write lines using a custom delimiter with the delim:x codec, where x is the character sequence custom delimiter.
Type: string
Default: "lines"
| Option | Summary |
|---|---|
all-bytes | Only applicable to file based outputs. Writes each message to a file in full, if the file already exists the old content is deleted. |
append | Append each message to the output stream without any delimiter or special encoding. |
lines | Append each message to the output stream followed by a line break. |
delim:x | Append each message to the output stream followed by a custom delimiter. |
# Examplescodec: linescodec: "delim:\t"codec: delim:foobar