liuxiaolong
2020-03-11 7848ce12f101f8e825b01a52e620f75514900ea9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package pubsub
 
type PubSub interface {
 
    Publish(Message)
 
    Surveyor() []string
 
    Recv() chan Message
 
    GetCliInfo() map[string]interface{}
 
    SetResp(interface{})
}
 
type Message struct {
    Id string
    Topic string
    Msg []byte
}
 
const (
    Topic_Camera = "camera"  //摄像机解码消息
    Topic_StackDecode = "stackDecode" //数据栈解码消息
    Topic_Task = "task" //任务消息
    Topic_Sdk = "sdk" //算法消息
    Topic_RuleProc = "ruleProcess" //ruleProcess消息
    Topic_Event = "event" //事件消息
)
 
func NewPublisher(url string,heartBeatUrl string,mode int) (PubSub,error) {
    return newPub(url,heartBeatUrl)
}
 
//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)
}