Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: usage #17

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading