Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
vest
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
vest
Commits
319894eb
Commit
319894eb
authored
Jan 14, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改提交方式
parent
5d0b6d55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
consum.py
moment/views/consum.py
+2
-3
No files found.
moment/views/consum.py
View file @
319894eb
...
...
@@ -26,7 +26,7 @@ from kafka import TopicPartition
def
kafka_consum
(
topic_name
=
None
):
topic_name
=
settings
.
KAFKA_TOPIC_NAME
consumser_obj
=
KafkaConsumer
(
topic_name
,
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
,
enable_auto_commit
=
Tru
e
,
consumser_obj
=
KafkaConsumer
(
topic_name
,
bootstrap_servers
=
settings
.
KAFKA_BROKER_LIST
,
enable_auto_commit
=
Fals
e
,
group_id
=
"vest"
,
auto_offset_reset
=
'earliest'
)
consumser_obj
.
subscribe
([
topic_name
,
])
...
...
@@ -41,8 +41,7 @@ def kafka_consum(topic_name=None):
while
True
:
begin
=
time
.
time
()
msg_dict
=
consumser_obj
.
poll
(
timeout_ms
=
10000
,
max_records
=
500
)
consumser_obj
.
commit_async
()
consumser_obj
.
commit
()
for
msg_value
in
msg_dict
.
values
():
for
msg
in
msg_value
:
card_info
=
json
.
loads
(
str
(
msg
.
value
,
encoding
=
"utf8"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment