Example #1
0
func SendMessage(cn, msg, cid string, container *gabs.Container) {
	counter[cid]++
	t := time.Now()
	timestr := t.Format(time.RFC3339Nano)
	container.Set(timestr, "timestamp")
	container.Set(UserId, "userid")
	container.Set(counter[cid], "counter")
	container.Set(ClusterId, "clusterid")
	container.Set(UUID, "uuid")
	container.Set(IP, "ip")
	container.Set(Hostname, "hostname")
	ars := strings.Split(cn, " ")
	if len(ars) == 3 {
		container.Set(ars[0], "typename")
		container.Set(ars[1], "taskid")
		container.Set(ars[2], "ports")
		container.Set(msg, "msg")
	} else {
		container.Set("", "msg")
	}
}