Example #1
0
func PushQueue(beginIndex int, msgQueue *message.MessageQueue) {
	startIndex := 0
	for {
		testMsg := &MessageTest{value: (startIndex + beginIndex)}
		msgQueue.Push(testMsg)
		startIndex = startIndex + 1

	}
}
Example #2
0
func ReadQueue(msgQueue *message.MessageQueue) {
	for {
		topMsg := msgQueue.Pop()
		if nil == topMsg {
			continue
		}
		curMsg, ok := topMsg.(*MessageTest)
		if ok {
			fmt.Println("value:%d, leftSize:%d", curMsg.value, msgQueue.Size())
		}
	}
}