servicecontext.go 562 B

1234567891011121314151617181920212223
  1. package svc
  2. import (
  3. "github.com/zeromicro/go-zero/zrpc"
  4. "ylink/bff/rpcbff/rpc/internal/config"
  5. "ylink/bff/rpcbff/rpc/internal/ext"
  6. "ylink/core/auth/rpc/auth"
  7. )
  8. type ServiceContext struct {
  9. Config config.Config
  10. AuthRpc auth.Auth
  11. }
  12. func NewServiceContext(c config.Config) *ServiceContext {
  13. consumerHandler := ext.ConsumerHandler{}
  14. consumerHandler.Init(c.KqChatMsgConf)
  15. go consumerHandler.ConsumerGroup.RegisterHandleAndConsumer(&consumerHandler)
  16. return &ServiceContext{
  17. Config: c,
  18. AuthRpc: auth.NewAuth(zrpc.MustNewClient(c.AuthRpcConf)),
  19. }
  20. }