// Depile la queue et retourne un objet de type ReservationInfos public ReservationInfos LireQueue() { MessageQueue mq = new MessageQueue(@".\private$\TEST"); mq.Formatter = new XmlMessageFormatter(new Type[] { typeof(ReservationInfos) }); ReservationInfos message = new ReservationInfos(); message = (ReservationInfos)mq.Peek().Body; mq.Receive(); mq.Close(); return(message); }
// Envoi un message sur la queue contenant un objet de type ReservationInfos public void EcrireQueue(ReservationInfos infos) { MessageQueue queue = null; if (MessageQueue.Exists(@".\private$\TEST")) { queue = new MessageQueue(@".\private$\TEST"); } else { MessageQueue.Create(@".\private$\TEST"); queue = new MessageQueue(@".\private$\TEST"); } queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(ReservationInfos) }); queue.Send(infos); queue.Close(); }