sarama.go 720 字节
package sarama

import (
	"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
	"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/message/kafkax"
	"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
	"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/sarama/messageHandler"
	//"suplus-message/pkg/constant"
	//"suplus-message/pkg/port/sarama/messageHandler"
)

func Run() {
	var (
		ucenterMessage = &messageHandler.UcenterMessageCommand{}
	)

	saramaConsumer := kafkax.NewSaramaConsumer(constant.KAFKA_HOSTS, constant.SERVICE_NAME)
	saramaConsumer.WithTopicHandler(constant.TOPIC_UCENT_USER_CHANGE_PHONE, ucenterMessage.ChangePhoneHandler)

	err := saramaConsumer.StartConsume()
	if err != nil {
		log.Error(err)
	}
}