优化kafka相关handler定义
This commit is contained in:
parent
f67febec16
commit
339e78bd12
@ -7,6 +7,8 @@
|
||||
// Date : 2021-09-23 10:58 下午
|
||||
package message
|
||||
|
||||
import "git.zhangdeman.cn/zhangdeman/gopkg/middleware/kafka"
|
||||
|
||||
// IMessageQueue 消息队列的接口约束
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
@ -22,3 +24,6 @@ type IMessageQueue interface {
|
||||
// Fail 失败回调
|
||||
Fail(data []byte, err error)
|
||||
}
|
||||
|
||||
// IKafkaMessageHandler 卡夫卡消息处理
|
||||
type IKafkaMessageHandler kafka.IConsumeDataHandler
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 11:11 下午 2021/9/23
|
||||
func NewMessageQueueWithKafka(producer kafka.Producer, consumer kafka.Consumer, sync bool, dataHandler kafka.IConsumeDataHandler) IMessageQueue {
|
||||
func NewMessageQueueWithKafka(producer kafka.Producer, consumer kafka.Consumer, sync bool, dataHandler IKafkaMessageHandler) IMessageQueue {
|
||||
return &QueueWithKafka{
|
||||
producer: producer,
|
||||
consumer: consumer,
|
||||
@ -35,7 +35,7 @@ type QueueWithKafka struct {
|
||||
producer kafka.Producer // 生产者
|
||||
consumer kafka.Consumer // 消费者
|
||||
sync bool // 同步发消息 or 异步
|
||||
dataHandler kafka.IConsumeDataHandler // 订阅到的数据处理方法
|
||||
dataHandler IKafkaMessageHandler // 订阅到的数据处理方法
|
||||
}
|
||||
|
||||
// Publish 发布消息
|
||||
|
Loading…
Reference in New Issue
Block a user