跳到主要内容
版本:2.3.10

Console

Console 数据接收器

支持连接器版本

  • 所有版本

支持的引擎

Spark
Flink
SeaTunnel Zeta

描述

接收Source端传入的数据并打印到控制台。支持批同步和流同步两种模式。

例如,来自上游的数据为 [age: 12, name: jared] ,则发送到控制台的内容为: {"name":"jared","age":17}

主要特性

接收器选项

名称类型是否必须默认值描述
common-options-Sink插件常用参数,请参考 Sink常用选项 了解详情
log.print.databoolean-确定是否应在日志中打印数据的标志。默认值为true
log.print.delay.msint-将每个数据项打印到日志之间的延迟(以毫秒为单位)。默认值为0

任务示例

简单示例:

随机生成的数据,包含两个字段,即 name(字符串类型)和 age(整型),写入控制台,并行度为 1

env {
parallelism = 1
job.mode = "STREAMING"
}

source {
FakeSource {
plugin_output = "fake"
schema = {
fields {
name = "string"
age = "int"
}
}
}
}

sink {
Console {
plugin_input = "fake"
}
}

多数据源示例:

多数据源示例,通过配置可以指定数据源写入指定接收器

env {
parallelism = 1
job.mode = "STREAMING"
}

source {
FakeSource {
plugin_output = "fake1"
schema = {
fields {
id = "int"
name = "string"
age = "int"
sex = "string"
}
}
}
FakeSource {
plugin_output = "fake2"
schema = {
fields {
name = "string"
age = "int"
}
}
}
}

sink {
Console {
plugin_input = "fake1"
}
Console {
plugin_input = "fake2"
}
}

控制台示例数据

控制台打印的输出:

2022-12-19 11:01:45,417 INFO  org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - output rowType: name<STRING>, age<INT>
2022-12-19 11:01:46,489 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=1: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: CpiOd, 8520946
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=2: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: eQqTs, 1256802974
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=3: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: UsRgO, 2053193072
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=4: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: jDQJj, 1993016602
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=5: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: rqdKp, 1392682764
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=6: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: wCoWN, 986999925
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=7: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: qomTU, 72775247
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=8: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: jcqXR, 1074529204
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=9: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: AkWIO, 1961723427
2022-12-19 11:01:46,490 INFO org.apache.seatunnel.connectors.seatunnel.console.sink.ConsoleSinkWriter - subtaskIndex=0 rowIndex=10: SeaTunnelRow#tableId=-1 SeaTunnelRow#kind=INSERT: hBoib, 929089763

变更日志

Change Log
ChangeCommitVersion
[improve] console sink options (#8743)https://github.com/apache/seatunnel/commit/c439b99f12.3.10
[Improve] restruct connector common options (#8634)https://github.com/apache/seatunnel/commit/f3499a6ee2.3.10
[Improve][dist]add UT class name check (#8182)https://github.com/apache/seatunnel/commit/9cf4192fe2.3.9
[Feature][Core] Support cdc task ddl restore for zeta (#7463)https://github.com/apache/seatunnel/commit/8e322281e2.3.9
[Feature][Restapi] Allow metrics information to be associated to logical plan nodes (#7786)https://github.com/apache/seatunnel/commit/6b7c53d032.3.9
[Feature][Core] Add event notify for all connector (#7501)https://github.com/apache/seatunnel/commit/d71337b0e2.3.8
[Improve][Connector] Add multi-table sink option check (#7360)https://github.com/apache/seatunnel/commit/2489f64462.3.7
Update ConsoleSinkFactory.java (#7350)https://github.com/apache/seatunnel/commit/9216627222.3.7
[Feature][Core] Support using upstream table placeholders in sink options and auto replacement (#7131)https://github.com/apache/seatunnel/commit/c4ca741222.3.6
[Feature][Core] Support event listener for job (#6419)https://github.com/apache/seatunnel/commit/831d0022e2.3.5
[Improve] Remove use SeaTunnelSink::getConsumedType method and mark it as deprecated (#5755)https://github.com/apache/seatunnel/commit/8de7408102.3.4
[Improve] Add default implement for SeaTunnelSink::setTypeInfo (#5682)https://github.com/apache/seatunnel/commit/86cba87452.3.4
[Feature] Support multi-table sink (#5620)https://github.com/apache/seatunnel/commit/81ac173182.3.4
[Improve] Refactor CatalogTable and add SeaTunnelSource::getProducedCatalogTables (#5562)https://github.com/apache/seatunnel/commit/41173357f2.3.4
[Feature][api env] Add job-level configuration for checkpoint timeout. (#5222)https://github.com/apache/seatunnel/commit/3c13275ed2.3.4
[Improve][CheckStyle] Remove useless 'SuppressWarnings' annotation of checkstyle. (#5260)https://github.com/apache/seatunnel/commit/51c0d709b2.3.4
[Feature][CDC][Zeta] Support schema evolution framework(DDL) (#5125)https://github.com/apache/seatunnel/commit/4f89c1d272.3.3
Merge branch 'dev' into merge/cdchttps://github.com/apache/seatunnel/commit/4324ee1912.3.1
[Improve][Project] Code format with spotless plugin.https://github.com/apache/seatunnel/commit/423b583032.3.1
[hotfix][zeta] fix zeta multi-table parser error (#4193)https://github.com/apache/seatunnel/commit/98f2ad0c12.3.1
[Feature][Zeta] Support shuffle multiple rows by tableId (#4147)https://github.com/apache/seatunnel/commit/8348f1a102.3.1
[Improve][build] Give the maven module a human readable name (#4114)https://github.com/apache/seatunnel/commit/d7cd601052.3.1
[Improve][Project] Code format with spotless plugin. (#4101)https://github.com/apache/seatunnel/commit/a2ab166562.3.1
[Improve][Connector-V2]console sink output content to slf4j log (#3745)https://github.com/apache/seatunnel/commit/82a5c852d2.3.1
[Hotfix][OptionRule] Fix option rule about all connectors (#3592)https://github.com/apache/seatunnel/commit/226dc6a112.3.0
[improve][connector] The Factory#factoryIdentifier must be consistent with PluginIdentifierInterface#getPluginName (#3328)https://github.com/apache/seatunnel/commit/d9519d6962.3.0
[Improve][Connector-V2][Console] Add Console option rule (#3322)https://github.com/apache/seatunnel/commit/efb4711602.3.0
[Improve][connector][console] print subtask index (#3000)https://github.com/apache/seatunnel/commit/de345783d2.3.0-beta
[Bug][Connector-V2] Fix the bug that can not print SeaTunnelRow correctly (#2749)https://github.com/apache/seatunnel/commit/9365d35202.2.0-beta
[Feature][Connector-V2] Add iceberg source connector (#2615)https://github.com/apache/seatunnel/commit/ffc6088a72.2.0-beta
[Bug][ConsoleSinkV2]fix fieldToString StackOverflow and add Unit-Test (#2545)https://github.com/apache/seatunnel/commit/6f87094562.2.0-beta
[Improve][Console] improve console to printf schema and deepToString fields (#2517)https://github.com/apache/seatunnel/commit/963387d372.2.0-beta
[api-draft][Optimize] Optimize module name (#2062)https://github.com/apache/seatunnel/commit/f79e3112b2.2.0-beta