liuxiaolong
2020-01-16 c43a8e3e552e00b653e40f45615bf46b2ddd40e2
pubsub.go
@@ -2,12 +2,15 @@
type PubSub interface {
   Publish([]byte)
   Publish(Message)
   Surveyor() []string
   Recv() chan Message
}
type Message struct {
   Id string
   Topic string
   Msg []byte
}
@@ -19,10 +22,11 @@
   Topic_Event = "event" //事件消息
)
func NewPublisher(url string,mode int) (PubSub,error) {
   return newPub(url)
func NewPublisher(url string,heartBeatUrl string,mode int) (PubSub,error) {
   return newPub(url,heartBeatUrl)
}
func NewSubscriber(url string,mode int,topics []string) (PubSub,error) {
   return newSub(url, topics)
//processId is process Identifier,unique
func NewSubscriber(url string,heartBeatUrl string,mode int,topics []string,processId string) (PubSub,error) {
   return newSub(url,heartBeatUrl, topics, processId)
}