Socket source connector

Support Those Engines

Spark
Flink
SeaTunnel Zeta

Key features

Description

Used to read data from Socket.

Data Type Mapping

The File does not have a specific type list, and we can indicate which SeaTunnel data type the corresponding data needs to be converted to by specifying the Schema in the config.

SeaTunnel Data type
STRING
SHORT
INT
BIGINT
BOOLEAN
DOUBLE
DECIMAL
FLOAT
DATE
TIME
TIMESTAMP
BYTES
ARRAY
MAP

Options

Name Type Required Default Description
host String Yes _ socket server host
port Integer Yes _ socket server port
common-options no - Source plugin common parameters, please refer to Source Common Options for details.

How to Create a Socket Data Synchronization Jobs

  • Configuring the SeaTunnel config file

The following example demonstrates how to create a data synchronization job that reads data from Socket and prints it on the local client:

  1. # Set the basic configuration of the task to be performed
  2. env {
  3. parallelism = 1
  4. job.mode = "BATCH"
  5. }
  6. # Create a source to connect to socket
  7. source {
  8. Socket {
  9. host = "localhost"
  10. port = 9999
  11. }
  12. }
  13. # Console printing of the read socket data
  14. sink {
  15. Console {
  16. parallelism = 1
  17. }
  18. }
  • Start a port listening
  1. nc -l 9999
  • Start a SeaTunnel task

  • Socket Source send test data

  1. ~ nc -l 9999
  2. test
  3. hello
  4. flink
  5. spark
  • Console Sink print data
  1. [test]
  2. [hello]
  3. [flink]
  4. [spark]