说明
Kafka Compositor
{
"name": "streaming.core.compositor.spark.streaming.source.KafkaStreamingCompositor",
"params": [{
"topics":"your topic",
"metadata.broker.list":"brokers",
"auto.offset.reset": "smallest|largest"
}]
}
参数说明:
MockInputStreamCompositor
模拟数据源,主要为了方便测试。
{
"name": "streaming.core.compositor.spark.streaming.source.MockInputStreamCompositor",
"params": [{
"batch-1":["1","2","3"],
"batch-2":["1","2","3"],
"batch-3":["1","2","3"],
"batch-4":["1","2","3"]
}]
}
MockInputStreamFromPathCompositor
模拟数据源,主要为了方便测试。可以接入一个外部文件作为mock数据
{
"name": "streaming.core.compositor.spark.streaming.source.MockInputStreamFromPathCompositor",
"params": [{"path":"file:///tmp/test.txt"}]
}
SingleColumnJSONCompositor
把一条日志转化一个单列的json文件。
{
"name": "streaming.core.compositor.spark.streaming.transformation.SingleColumnJSONCompositor",
"params": [{
"name": "a"
}]
}
params.name 则是列名,方便后续的sql使用。
ScalaMapToJSONCompositor
{
"name": "streaming.core.compositor.spark.streaming.transformation.ScalaMapToJSONCompositor",
"params": [{}]
}
可以把scala Map转化为JSon
JavaMapToJSONCompositor
{
"name": "streaming.core.compositor.spark.streaming.transformation.JavaMapToJSONCompositor",
"params": [{}]
}
可以把java Map转化为JSon
FlatJSONCompositor
{
"name": "streaming.core.compositor.spark.streaming.transformation.FlatJSONCompositor",
"params": [{"a":"$['store']['book'][0]['title']"}]
}
从JSON里抽取字段,映射到新的列名上。主要是对复杂JSON结构进行扁平化。语法参考该库JsonPath
NginxParserCompositor
{
"name": "streaming.core.compositor.spark.streaming.transformation.NginxParserCompositor",
"params": [{"time":0,"url":1}]
}
Nginx 日志解析工具,按位置给列进行命名。
SQLCompositor
{
"name": "streaming.core.compositor.spark.streaming.transformation.SQLCompositor",
"params": [
{
"sql": "select a, \"5\" as b from test",
"outputTableName": "test2"
}
]
}
SQLESOutputCompositor
将数据存储到ES中
{
"name":"streaming.core.compositor.spark.streaming.output.SQLESOutputCompositor",
"params":[
{
"es.nodes":"",
"es.resource":"",
"es.mapping.include":"",
"timeFormat":"yyyyMMdd"
}
]
}
SQLPrintOutputCompositor(output)
{
"name": "streaming.core.compositor.spark.streaming.output.SQLPrintOutputCompositor",
"params": [{}]
}
把处理结果打印到终端控制台。主要是为了调试使用
JSONTableCompositor
{
"name": "streaming.core.compositor.spark.streaming.transformation.JSONTableCompositor",
"params": [{
"tableName": "test"
}]
}
把字符串(JSON格式)的数据注册成一张表。 params.tableName可以让你指定表名。
ConsoleOutputCompositor
{
"name": "streaming.core.compositor.spark.streaming.output.ConsoleOutputCompositor",
"params": [{ }]
}
控制台打印,非SQL类。
SQLCSVOutputCompositor
{
"name": "streaming.core.compositor.spark.streaming.output.SQLCSVOutputCompositor",
"params": [{
"path":"",
"mode":""
}]
}
作为CSV 输出,需要前面是一张表。
SQLParquetOutputCompositor
{
"name": "streaming.core.compositor.spark.streaming.output.SQLParquetOutputCompositor",
"params": [{
"path":"",
"mode":""
}]
}
作为parquet 输出,需要前面是一张表。