示例#1
0
 public async Task RouteMessageAsync(string partitionId, Message msg)
 {
     if (_routingDictionary.TryGetValue(msg.VersionedMessageType, out var pipelines))
     {
         //TODO: Run loop in parallel
         foreach (var pipeline in pipelines)
         {
             await pipeline.ProcessMessageAsync(partitionId, msg);
         }
     }
     else if (_unhandledEventPipeline != null)
     {
         //default pipeline
         await _unhandledEventPipeline?.ProcessMessageAsync(partitionId, msg);
     }
 }
示例#2
0
        public async Task RouteMessageAsync(Message msg)
        {
            //TODO: Fix Message Key to something more elegant
            var versionedMessageType = new VersionedMessageType {
                MessageType = msg.MessageType, Version = msg.Version
            };

            if (_routingDictionary.TryGetValue(versionedMessageType.Key, out var pipelines))
            {
                //TODO: Run loop in parallel
                foreach (var pipeline in pipelines)
                {
                    await pipeline.ProcessMessageAsync(msg);
                }
            }
            else if (_unhandledEventPipeline != null)
            {
                //default pipeline
                await _unhandledEventPipeline?.ProcessMessageAsync(msg);
            }
        }