public Task SendInitiativeLoggedAsync(InitiativeLoggedEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (args.Initiative == null)
            {
                throw new ArgumentException("Initiative cannot be null");
            }
            if (args.Owner == null)
            {
                throw new ArgumentException("Owner cannot be null");
            }

            _logger.Information("Posting InitiativeLogged event to service bus for Initiative {InitiativeId}", args.Initiative.Id);

            // note args.RangeUpdated is allowed to be null

            var userProperties = new Dictionary <string, object>();

            SetInitiative(args.Initiative, userProperties);
            SetOwner(args.Owner, userProperties);
            SetRangeUpdated(args.RangeUpdated, userProperties);
            return(_messageSender.SendMessageAsync(INITIATIVE_LOGGED, userProperties));
        }
예제 #2
0
        public Task SendInitiativeLoggedAsync(InitiativeLoggedEventArgs args)
        {
            var tasks             = new List <Task>();
            var cancellationToken = new System.Threading.CancellationToken();

            foreach (var h in _messageReceiver.InitiativeLoggedHandlers)
            {
                tasks.Add(h(args, cancellationToken));
            }
            return(Task.WhenAll(tasks));
        }