Esempio n. 1
0
 /// <summary>
 /// 在远程删除邮箱
 /// </summary>
 /// <param name="mail"></param>
 public void WrittenOff(LocalMessageMail mail)
 {
     try {
         CentralizedService.WrittenOffMail(mail.MailName);
     }
     finally {
         _messageBusMails.TryRemove(mail.MailName, out LocalMessageMail value);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 订阅邮箱,服务总线不存在则抛出异常
 /// </summary>
 /// <param name="mailname"></param>
 /// <returns></returns>
 public LocalMessageMail OpenMail(string mailname)
 {
     if (CentralizedService.IsMailName(mailname))
     {
         LocalMessageMail messageBusMail = null;
         _messageBusMails.AddOrUpdate(mailname, s => {
             messageBusMail = new LocalMessageMail(this)
             {
                 MailName = mailname
             };
             return(messageBusMail);
         },
                                      (s, mail) => {
             messageBusMail = mail;
             return(mail);
         });
         return(messageBusMail);
     }
     throw new Exception("没有相应名称的远程邮箱");
 }
Esempio n. 3
0
 /// <summary>
 /// 停止在本地订阅
 /// </summary>
 /// <param name="mail"></param>
 public void CloseMail(LocalMessageMail mail)
 {
     _messageBusMails.TryRemove(mail.MailName, out LocalMessageMail value);
 }