fix
This commit is contained in:
16
server/websocket/consumer/consumer.go
Normal file
16
server/websocket/consumer/consumer.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package consumer
|
||||
|
||||
import "fmt"
|
||||
|
||||
type MqHandle interface {
|
||||
Run(data []byte) error
|
||||
}
|
||||
|
||||
// 消费渲染结果数据
|
||||
type MqConsumerRenderResult struct {
|
||||
}
|
||||
|
||||
func (m *MqConsumerRenderResult) Run(data []byte) error {
|
||||
fmt.Println("收到消息:" + string(data))
|
||||
return nil
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"fusenapi/constants"
|
||||
"fusenapi/server/websocket/consumer"
|
||||
"net/http"
|
||||
|
||||
"fusenapi/utils/auth"
|
||||
@@ -27,6 +30,11 @@ func main() {
|
||||
defer server.Stop()
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
//消费组装队列
|
||||
ctx1 := context.Background()
|
||||
ctx2, cancel := context.WithCancel(ctx1)
|
||||
defer cancel()
|
||||
go ctx.RabbitMq.Consume(ctx2, constants.RABBIT_MQ_ASSEMBLE_RENDER_DATA, &consumer.MqConsumerRenderResult{})
|
||||
handler.RegisterHandlers(server, ctx)
|
||||
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
|
||||
server.Start()
|
||||
|
||||
Reference in New Issue
Block a user