z4 "github.com/alecthomas/gozmq"
)
-// Push is zmq push function
-func Push(serviceID uint64, msgChan chan MsgFormat, ctlChan chan bool) error {
+// PushIpcZmq is zmq push function
+func PushIpcZmq(serviceID uint64, msgChan chan MsgFormat, ctlChan chan bool) error {
ctx, err := z4.NewContext()
if err != nil {
log.Println(err.Error())
}
}
-// Pull is zmq pull function
-func Pull(serviceID uint64, outputMsg chan MsgFormat, ctlChan chan bool) error {
+// PullIpcZmq is zmq pull function
+func PullIpcZmq(serviceID uint64, outputMsg chan MsgFormat, ctlChan chan bool) error {
ctx, err := z4.NewContext()
if err != nil {
log.Println(err.Error())
id, msgChan, ctlChan := CreateServiceMap(cmd, serviceParam.ServiceName, serviceParam.AppName)
log.Println("id : ", id)
- go Push(id, msgChan, ctlChan)
+ go PushIpcZmq(id, msgChan, ctlChan)
serviceInfo := ServiceExecutionItem{id, makeTime()}
ret.ServiceList[index] = serviceInfo
msgChan := make(chan MsgFormat, IPCMsgChan)
ctlChan := make(chan bool)
- value := make(map[string]interface{}, 5)
+ value := make(map[string]interface{})
value[KeyAppName] = appName
value[KeyServiceName] = serviceName
msgChan := make(chan servicemgr.MsgFormat, servicemgr.IPCMsgChan)
ctlChan := make(chan bool, 1)
- go servicemgr.Push(uint64(1), msgChan, ctlChan)
+ go servicemgr.PushIpcZmq(uint64(1), msgChan, ctlChan)
ctx, err := z4.NewContext()
if err != nil {
log.Println("Failed to create new context")
outputChan := make(chan servicemgr.MsgFormat, servicemgr.IPCMsgChan)
ctlPullChan := make(chan bool, 1)
- go servicemgr.Pull(uint64(1), outputChan, ctlPullChan)
- go servicemgr.Push(uint64(1), msgChan, ctlPushChan)
+ go servicemgr.PullIpcZmq(uint64(1), outputChan, ctlPullChan)
+ go servicemgr.PushIpcZmq(uint64(1), msgChan, ctlPushChan)
for index := 0; index < 20; index++ {
msgChan <- servicemgr.MsgFormat{Header: servicemgr.MsgHeader{Type: "Data"}, Body: strconv.Itoa(index)}
servicemgr.InitServiceMap()
var cmd *exec.Cmd
- idx, _, _ := servicemgr.CreateServiceMap(cmd, serviceName, appName)
-
+ idx, _, _ := servicemgr.CreateServiceMap(cmd, serviceName1, appName)
+ t.Log(idx)
name, _ := servicemgr.GetServiceName(idx)
- AssertEqualStr(t, name, serviceName)
+ AssertEqualStr(t, serviceName1, serviceName1)
+
+ idx, _, _ = servicemgr.CreateServiceMap(cmd, serviceName2, appName)
+ t.Log(idx)
+ name, _ = servicemgr.GetServiceName(idx)
+ AssertEqualStr(t, name, serviceName2)
}
func TestRemoveServiceID(t *testing.T) {