This commit is contained in:
laodaming
2023-08-07 11:44:54 +08:00
parent 36efad44df
commit 315ad19dd4
8 changed files with 37 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ import (
"crypto/tls"
"errors"
"fusenapi/constants"
"fusenapi/server/websocket/consumer"
"fusenapi/utils/mq_consumer_factory"
"github.com/streadway/amqp"
"github.com/zeromicro/go-zero/core/logx"
"log"
@@ -84,10 +84,10 @@ func (h *RabbitMqHandle) SendMsg(queueName constants.RABBIT_MQ, message []byte)
}
// 消费消息
func (h *RabbitMqHandle) Consume(ctx context.Context, queueName constants.RABBIT_MQ, handle consumer.MqHandle) error {
func (h *RabbitMqHandle) Consume(ctx context.Context, queueName constants.RABBIT_MQ, handle mq_consumer_factory.MqHandle) {
object, ok := mapMq[queueName]
if !ok {
return errors.New("unknown queue")
panic("unknown queue")
}
go func() {
select {
@@ -135,5 +135,4 @@ func (h *RabbitMqHandle) Consume(ctx context.Context, queueName constants.RABBIT
}(msg)
}
wait.Wait()
return nil
}