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
a8a64ccf
Commit
a8a64ccf
authored
Jan 02, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断等级
parent
51fb4d05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
consum.py
moment/views/consum.py
+5
-2
No files found.
moment/views/consum.py
View file @
a8a64ccf
...
...
@@ -28,7 +28,7 @@ def kafka_consum(topic_name=None):
auto_commit_interval_ms
=
1
,
group_id
=
"vest"
)
consumser_obj
.
subscribe
([
topic_name
,
])
try
:
redis_topic_partition_name
=
"vest:topic_name:"
+
str
(
topic_name
)
#
redis_topic_partition_name = "vest:topic_name:" + str(topic_name)
# topic_partition_info = redis_client.hgetall(redis_topic_partition_name)
# for partition_id in topic_partition_info:
# print (int(partition_id.decode()),topic_name)
...
...
@@ -46,7 +46,7 @@ def kafka_consum(topic_name=None):
if
bol_consum
:
logging
.
info
(
"消费到新数据了[
%
s,
%
s,
%
s,
%
s],get card_info:
%
s"
%
(
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
),
card_info
))
redis_client
.
hset
(
redis_topic_partition_name
,
msg
.
partition
,
msg
.
offset
)
#
redis_client.hset(redis_topic_partition_name, msg.partition, msg.offset)
# 代表当天数据
current_push_time
=
card_info
[
'current_push_time'
]
create_time
=
card_info
[
'create_time'
]
...
...
@@ -154,6 +154,9 @@ def kafka_consum(topic_name=None):
str
(
msg
.
topic
),
str
(
msg
.
partition
),
str
(
msg
.
offset
),
str
(
msg
.
key
)))
save_data_to_kafka
(
card_info
)
pass
else
:
logging
.
info
(
"此条数据已经消费过了"
)
pass
logging
.
info
(
"消费处理耗时:
%
f"
%
(
time
.
time
()
-
begin
))
except
:
consumser_obj
.
close
()
...
...
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