message_services.go
947 字节
package service
import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/json"
"gitlab.fjmaimaimai.com/mmm-go-pp/egglib-go-demos/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go-pp/egglib-go-demos/pkg/application/message/command"
)
type MessageService struct {
transactionContext application.TransactionContext
}
func (messageService *MessageService) PushMessage(pushMessageCommand *command.PushMessageCommand) (interface{}, error) {
log.Logger.Info(fmt.Sprintf("receive msg %v", json.MarshalToString(pushMessageCommand)))
return nil, nil
}
func NewMessageService(options map[string]interface{}) *MessageService {
var transactionContext application.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(application.TransactionContext)
}
newMessageService := &MessageService{
transactionContext: transactionContext,
}
return newMessageService
}