implement MsgQueue and test it