private void ReceiveMessage(string topic) { using (var transaction = TransactionScopeFactory.CreateReadCommittedScope()) { try { var msgEntity = this.msgRepo.GetFirstMessage(this.SysCode, topic); var message = msgEntity.Map <Envelope <IMessage> >(); var messageId = msgEntity.Id; this.MessageReceived(new MessageReceivedEventArgs(message)); this.msgRepo.Delete(messageId); } catch (Exception ex) { //TODO:記錄日誌 throw ex; } transaction.Complete(); } }