Exemplo n.º 1
0
        public async Task InvokeAsync(HttpContext context, ISubscriptionsRepository subscriptionsRepository, IMapper mapper, IOptions <AwesomeEventGridOptions> options)
        {
            var routeData     = context.GetRouteData();
            var topic         = context.Request.Query["topic"].FirstOrDefault();
            var subscriptions = subscriptionsRepository.GetAll(topic);

            var model = mapper.Map <IEnumerable <SubscriptionModel> >(subscriptions);

            await Ok(context, model);
        }
Exemplo n.º 2
0
        public async Task HandleAsync(string topic, params EventModel[] events)
        {
            var dispatcherTasks = new List <Task>();

            foreach (var @event in events)
            {
                var subscriptions = subscriptionsRepository.GetAll(topic)
                                    .Where(s => s.EventTypes == null || s.EventTypes.Contains(@event.EventType))
                                    .Select(s => subscriberEventDispatcher.Dispatch(mapper.Map <SubscriptionModel>(s), @event));

                dispatcherTasks.AddRange(subscriptions);
            }

            await Task.WhenAll(dispatcherTasks);
        }
Exemplo n.º 3
0
 public IEnumerable <SubscriptionDTO> GetAll() => subscriptionsRepository.GetAll();
 public IEnumerable <Models.OfficeSubscription> GetAllSubscriptions()
 {
     return(SubscriptionsRepository.GetAll());
 }