servicecontext.go 379 B

123456789101112131415161718
  1. package svc
  2. import (
  3. "ylink/core/cmd/rpc/internal/config"
  4. "ylink/ext/kafka"
  5. )
  6. type ServiceContext struct {
  7. Config config.Config
  8. ChatMsgProducer *kafka.Producer
  9. }
  10. func NewServiceContext(c config.Config) *ServiceContext {
  11. return &ServiceContext{
  12. Config: c,
  13. ChatMsgProducer: kafka.NewKafkaProducer(c.KqChatMsgConf.Brokers, c.KqChatMsgConf.Topic),
  14. }
  15. }