Пример #1
0
        /// <summary>
        /// 订阅消息
        /// </summary>
        /// <param name="streamNamespaces">(自己作为Observer)侦听的StreamNamespace</param>
        /// <param name="token">StreamSequenceToken</param>
        protected async Task SubscribeAsync(string streamNamespaces, StreamSequenceToken token = null)
        {
            IAsyncStream <TEvent> worker = ClusterClient.GetSimpleMessageStreamProvider().GetStream <TEvent>(StreamId, streamNamespaces);

            await SubscribeAsync(worker, token);

            ListenStreamWorkers[streamNamespaces] = worker;
        }
Пример #2
0
 /// <summary>
 /// 发送消息
 /// </summary>
 protected Task Send(TEvent content, string streamNamespace = Standards.UnknownValue, StreamSequenceToken token = null)
 {
     return(ClusterClient.GetSimpleMessageStreamProvider().GetStream <TEvent>(StreamId, streamNamespace).OnNextAsync(content, token));
 }