Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
logtransfer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
谢宇轩
logtransfer
Commits
38764ddb
Commit
38764ddb
authored
Dec 12, 2021
by
谢宇轩
😅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去除多余的变量
parent
680ac7fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
customer.go
source/customer.go
+10
-0
kernel.go
transfer/kernel.go
+1
-13
No files found.
source/customer.go
View file @
38764ddb
...
...
@@ -59,6 +59,16 @@ func GetCustomer(topic string) (customer *Customer, ok bool) {
return
customer
,
ok
}
// 获取全部的注册过的消费处理器 所使用的的Topic名字
func
GetRegisterTopics
()
(
topics
[]
string
)
{
mu
.
Lock
()
for
topic
:=
range
CustomerManger
{
topics
=
append
(
topics
,
topic
)
}
mu
.
Unlock
()
return
topics
}
// 從Kafka中消費消息,注意这里会提交commit offset
func
ReadingMessage
(
ctx
context
.
Context
,
c
*
Customer
)
{
...
...
transfer/kernel.go
View file @
38764ddb
...
...
@@ -19,21 +19,9 @@ import (
var
(
Start
=
make
(
chan
*
source
.
Customer
)
Close
=
make
(
chan
string
)
CustomerManger
=
make
(
map
[
string
]
*
source
.
Customer
)
MaxRetryTime
=
10
mu
sync
.
Mutex
closeWg
sync
.
WaitGroup
)
func
getRegisterTopics
()
(
topics
[]
string
)
{
mu
.
Lock
()
for
topic
:=
range
CustomerManger
{
topics
=
append
(
topics
,
topic
)
}
mu
.
Unlock
()
return
topics
}
// 核心启动
func
Run
(
confPath
string
)
{
// 加载配置
...
...
@@ -84,7 +72,7 @@ func Run(confPath string) {
case
syscall
.
SIGHUP
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
:
log
.
Println
(
"Safe Exit with:"
,
sign
)
currentTopics
:=
g
etRegisterTopics
()
currentTopics
:=
source
.
G
etRegisterTopics
()
for
_
,
topic
:=
range
currentTopics
{
...
...
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