Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
my_flask_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fe0b2490
authored
Jan 30, 2024
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
z-gps-kafka-consumer-test-pingan30
1 parent
55b81923
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
__pycache__/test.cpython-39.pyc
kafka_consumer/test01.py
__pycache__/test.cpython-39.pyc
View file @
fe0b249
No preview for this file type
kafka_consumer/test01.py
0 → 100644
View file @
fe0b249
from
kafka
import
KafkaConsumer
# 创建Kafka消费者
consumer
=
KafkaConsumer
(
"gps_gpsandbs_pingan2"
,
# Kafka主题名称
bootstrap_servers
=
"192.168.3.131:9092"
,
# Kafka集群的地址
group_id
=
"my-yang-group"
,
# 消费者组ID
)
# 循环消费消息
for
message
in
consumer
:
# 从消息中获取键和值
key
=
message
.
key
value
=
message
.
value
print
(
f
"Key: {key}, Value: {value}"
)
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment