Skip to content

Commit

Permalink
docs: usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyang90 committed Jun 28, 2024
1 parent 6410c4f commit 389fae0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
data.txt

target/
data/
logs/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ cd subscribeDemo-java
bin/start.sh
```

## config
edit the `config/application.yml` and `consumer.properties` to change the configuration


## change log

### 2024-04-28
Expand Down
31 changes: 23 additions & 8 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
subscriber:
# consumer 的并发
concurrency: 1
# 要订阅哪些topic,以逗号分隔
topic-names: tp1,tp2,tp3
# 每次 pull 的超时时间
poll-timeout: 1000
# pull 以后,写到一个文件里
output-file: ./data.txt
# 是否在log 里面打印数据
print-data-in-log: false
# 是否在log里打印数据的offset
print-offset-in-log: false
# 是否在pull以后执行commit
commit-after-poll: false
# seek-to:
# offsets:
# - topic: tp1
# vGroupId: 21
# offset: 0
# - topic: tp2
# vGroupId: 21
# offset: 0
# 要不要在一开始执行seek,可以指seek 到指定的offset
# seek-to:
# offsets:
# - topic: tp1
# vGroupId: 21
# offset: 0
# - topic: tp2
# vGroupId: 21
# offset: 0
# consumer 的配置
consumer-properties-file: ./consumer.properties
# 要把数据格式化成什么形式
record-formatter:
# 支持:csv, json, keyvalue
type: csv
# 格式里是否带 partition 和 offset 这2列
with-partition-offset: true
csv:
# 分隔符
delimiter: '\t'
# 是否带首行
with-title: true
# 日志等级
logging:
level:
com.taosdata.demo: info
4 changes: 4 additions & 0 deletions src/main/resources/consumer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ auto.commit.interval.ms=1000
auto.offset.reset=earliest
msg.with.table.name=true
################ Deserializer parameter ################
# timestamp format
deserializer.timestamp.format=datetime
# timestamp precision: ms, us, ns
deserializer.timestamp.precision=ms
# convert binary data to string
deserializer.binary.as.string=true
# latency = pull timestamp - data timestamp
deserializer.calculate.latency=false

0 comments on commit 389fae0

Please sign in to comment.