/// <summary> /// 追加默认消息流管道 /// </summary> /// <typeparam name="TMsg"></typeparam> /// <param name="pipe"></param> /// <param name="msgDataKey">消息pipeDataKey,默认对应的flow是异步线程池</param> /// <param name="option"></param> /// <returns></returns> public static BaseMsgFlow <TMsg> AppendMsgFlow <TMsg>(this IPipeAppender <TMsg> pipe, string msgDataKey, DataFlowOption option = null) { var nextPipe = new SimpleMsgFlow <TMsg>(msgDataKey, option); pipe.InterAppend(nextPipe); return(nextPipe); }
/// <summary> /// 异步缓冲连接器 /// </summary> /// <param name="pipeCode">缓冲DataFlow 对应的Key 默认对应的flow是异步线程池</param> /// <param name="option"></param> protected BaseMsgFlow(string pipeCode, DataFlowOption option) : base(pipeCode, PipeType.MsgFlow) { if (string.IsNullOrEmpty(pipeCode)) { throw new ArgumentNullException(nameof(pipeCode), "消息类型PipeCode不能为空!"); } _pusher = CreateFlow(pipeCode, this, option); }
public PipeWatcherProxy(IPipeLineWatcher watcher, string dataFlowKey, DataFlowOption option) { if (!string.IsNullOrEmpty(dataFlowKey)) { _dataFlowKey = dataFlowKey; _publisher = DataFlowFactory.RegisterFlow <WatchDataItem>(dataFlowKey, WatchCallBack, option); } else { _watchDataQueue = new ActionBlock <WatchDataItem>(WatchCallBack, new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = 4 }); } _watcher = watcher; }
/// <summary> /// 创建消息流 /// </summary> /// <param name="subscriber"></param> /// <param name="option"></param> /// <param name="pipeDataKey"></param> /// <returns></returns> protected abstract IDataPublisher CreateFlow(string pipeDataKey, IDataSubscriber <TMsg> subscriber, DataFlowOption option);
protected override IDataPublisher CreateFlow(string pipeDataKey, IDataSubscriber <TContext> subscriber, DataFlowOption option) { return(DataFlowFactory.RegisterFlow(pipeDataKey, subscriber, option)); }
/// <summary> /// 消息流 /// </summary> /// <param name="pipeCode">缓冲DataFlow 对应的Key 默认对应的flow是异步线程池</param> /// <param name="option"></param> public SimpleMsgFlow(string pipeCode, DataFlowOption option) : base(pipeCode, option) { }