回到目录大家好,今天有时间来介绍一下Lind.DDD框架里的消息机制,消息发送这块一般的实现方法是将Email,SMS等集成到一个公用类库里,而本身Email和SMS没什么关系,它们也不会有什么接口约定,即你想实现某种消息的多态发送,不需要程序代码,基本不可能实现,而在Lind. ...
回到目录
大家好,今天有时间来介绍一下Lind.DDD框架里的消息机制,消息发送这块一般的实现方法是将Email,SMS等集成到一个公用类库里,而本身Email和SMS没什么关系,它们也不会有什么接口约定,即你想实现某种消息的多态发送,不需要程序代码,基本不可能实现,而在Lind.DDD里面,大叔将它进行了抽象,消息有自己的统一接口,而对于email和sms只是一种实现而以,这样,就可以发挥get='_blank'>面向对象的特性,在sms,email甚至是rtx上进行消息的灵活切换了,说到这样,您心动了吧!
Lind.DDD.Messaging框架图
接口规范
/// <summary> /// Message Interface /// Author:Garrett /// </summary> public interface IMessageManager { /// <summary> /// Sends a message to a channel using a content item as the recipient /// </summary> /// <param name="recipient">接收者</param> /// <param name="subject">主题</param> /// <param name="body">消息主体</param> /// <param name="serverVirtualPath">本参数可以没有,服务端模块级路径,只在xmpp中有意义</param> void Send(string recipient, string subject, string body, string serverVirtualPath = null); /// <summary> /// Sends a message to a channel using a set of content items as the recipients /// </summary> /// <param name="recipients">A set of content items to send the message to. Only one message may be sent if the channel manages it.</param> /// <param name="type">A custom string specifying what type of message is sent. Used in even handlers to define the message.</param> /// <param name="service">The name of the channel to use, e.g. "email"</param> /// <param name="properties">A set of specific properties for the channel.</param> void Send(IEnumerable<string> recipients, string subject, string body, string serverVirtualPath = null); /// <summary> /// Async Sends a message to a channel using a set of content items as the recipients /// </summary> /// <param name="recipients">A set of content items to send the message to. Only one message may be sent if the channel manages it.</param> /// <param name="type">A custom string specifying what type of message is sent. Used in even handlers to define the message.</param> /// <param name="service">The name of the channel to use, e.g. "email"</param> /// <param name="properties">A set of specific properties for the channel.</param> /// <param name="isAsync">is Async</param> void Send(IEnumerable<string> recipients, string subject, string body, bool isAsync, string serverVirtualPath = null); }
原标题:Lind.DDD.Messaging框架通讯组件介绍
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。