Ejemplo n.º 1
0
        protected bool Store(TestMessage message)
        {
            using (var msgStream = new MemoryStream(message.OriginalMessage))
            {
                var result = Persister.InsertMessage(message.ClientId, message.TimeReceived, msgStream, message.Headers);

                return result;
            }
        }
Ejemplo n.º 2
0
        protected TestMessage GetStoredMessage(string clientId)
        {
            using (var session = Persister.SessionFactory.OpenSession())
            using (var tx = session.BeginTransaction(IsolationLevel.ReadCommitted))
            {
                var messageStored = session.Get<GatewayMessage>(clientId);

                var msg = new TestMessage
                {
                    ClientId = messageStored.Id,
                    Headers = ConvertStringToDictionary(messageStored.Headers),
                    TimeReceived = messageStored.TimeReceived,
                    OriginalMessage = messageStored.OriginalMessage,
                    Acknowledged = messageStored.Acknowledged
                };

                tx.Commit();

                return msg;
            }
        }