/// <inheritdoc /> public SimpleMsgPublisher(string pipeCode, DataPublisherOption option = null) : this(pipeCode, null, option) { }
/// <inheritdoc /> protected override IDataPublisher CreatePublisher(DataPublisherOption option) { return(DataFlowFactory.CreatePublisher(option)); }
/// <summary> /// 消息发布者 /// </summary> /// <param name="pipeCode"></param> /// <param name="pushKeyGenerator"></param> /// <param name="option"></param> public SimpleMsgPublisher(string pipeCode, Func <TMsg, string> pushKeyGenerator, DataPublisherOption option) : base( pipeCode, option) { _pushKeyGenerator = pushKeyGenerator; }
/// <summary> /// 追加默认消息发布者管道 /// </summary> /// <typeparam name="TMsg"></typeparam> /// <param name="pipe"></param> /// <param name="pushKeyGenerator">消息key生成器,为空则使用pipeCode作为发布消息key</param> /// <param name="option"></param> /// <returns></returns> public static void AppendMsgPublisher <TMsg>(this IPipeAppender <TMsg> pipe, Func <TMsg, string> pushKeyGenerator, DataPublisherOption option = null) { var nextPipe = new SimpleMsgPublisher <TMsg>(string.Empty, pushKeyGenerator, option); pipe.InterAppend(nextPipe); }
/// <summary> /// 追加默认消息发布者管道 /// </summary> /// <typeparam name="TMsg"></typeparam> /// <param name="pipe"></param> /// <param name="msgDataKey">消息pipeDataKey,默认消息实现对应的flow是异步线程池</param> /// <param name="option"></param> /// <returns></returns> public static void AppendMsgPublisher <TMsg>(this IPipeAppender <TMsg> pipe, string msgDataKey, DataPublisherOption option = null) { var nextPipe = new SimpleMsgPublisher <TMsg>(msgDataKey, null, option); pipe.InterAppend(nextPipe); }
/// <summary> /// 创建消息流 /// </summary> /// <param name="option"></param> /// <returns></returns> protected abstract IDataPublisher CreatePublisher(DataPublisherOption option);
/// <summary> /// 消息发布者 /// </summary> /// <param name="defaultPushMsgKey">缓冲DataFlow 对应的消息Key 默认对应的flow实现是异步线程池</param> /// <param name="option"></param> protected BaseMsgPublisher(string defaultPushMsgKey, DataPublisherOption option = null) : base(defaultPushMsgKey, PipeType.MsgPublisher) { _pusher = CreatePublisher(option); }