切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
唐旭辉
5 years ago
提交
062b7fc738936a7b1e37c539b30107312018358b
1 个父辈
7933ee98
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
9 行增加
和
6 行删除
pkg/port/consumer/consumer.go
pkg/port/consumer/topic_handle_router.go
pkg/port/consumer/consumer.go
查看文件 @
062b7fc
...
...
@@ -135,6 +135,10 @@ func (r *Runer) Start(ctx context.Context) {
logs
.
Error
(
e
)
}
}()
if
len
(
r
.
msgConsumer
.
topics
)
==
0
{
logs
.
Error
(
"there has no topics"
)
return
}
for
{
select
{
case
<-
ctx
.
Done
()
:
...
...
pkg/port/consumer/topic_handle_router.go
查看文件 @
062b7fc
...
...
@@ -4,7 +4,6 @@ import (
"os"
"github.com/Shopify/sarama"
"github.com/astaxie/beego/logs"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/port/consumer/handles"
)
...
...
@@ -13,11 +12,11 @@ type TopicHandle func(*sarama.ConsumerMessage) error
//TopicHandleRouters 根据topic区分消息并进行处理
var
TopicHandleRouters
=
map
[
string
]
TopicHandle
{
"topic_test"
:
func
(
message
*
sarama
.
ConsumerMessage
)
error
{
logs
.
Info
(
"Done Message claimed: timestamp = %v, topic = %s offset = %v value = %v
\n
"
,
message
.
Timestamp
,
message
.
Topic
,
message
.
Offset
,
string
(
message
.
Value
))
return
nil
},
// "topic_test": func(message *sarama.ConsumerMessage) error {
// logs.Info("Done Message claimed: timestamp = %v, topic = %s offset = %v value = %v \n",
// message.Timestamp, message.Topic, message.Offset, string(message.Value))
// return nil
// },
}
func
init
()
{
...
...
请
注册
或
登录
后发表评论