예제 #1
0
        public void ProcessMessage(IHandlerContext <RemoveScheduleCommand> context)
        {
            Guard.AgainstNull(context, nameof(context));

            var message = context.Message;

            using (_databaseContextFactory.Create(message.DataStoreId))
            {
                _scheduleRepository.Remove(message.Id);
            }
        }
        public void ProcessMessage(IHandlerContext <AddSubscriptionCommand> context)
        {
            Guard.AgainstNull(context, "context");

            var message = context.Message;

            using (_databaseContextFactory.Create(message.DataStoreId))
            {
                _subscriptionQuery.Add(new Subscription
                {
                    MessageType       = message.MessageType,
                    InboxWorkQueueUri = message.InboxWorkQueueUri
                });
            }
        }
        public IActionResult Get(Guid dataStoreId)
        {
            using (_databaseContextFactory.Create(dataStoreId))
            {
                return(Ok(new
                {
                    Data = _subscriptionQuery.All()
                           .Select(subscription =>
                    {
                        string securedUri;

                        try
                        {
                            securedUri = new Uri(subscription.InboxWorkQueueUri).Secured().ToString();
                        }
                        catch
                        {
                            securedUri = "(invalid uri)";
                        }

                        return new
                        {
                            DataStoreId = dataStoreId,
                            subscription.MessageType,
                            subscription.InboxWorkQueueUri,
                            SecuredUri = securedUri
                        };
                    })
                }));
            }
        }
예제 #4
0
        public IActionResult Get(Guid dataStoreId, string match = null)
        {
            using (_databaseContextFactory.Create(dataStoreId))
            {
                return(Ok(new
                {
                    Data = _scheduleQuery.Search(match ?? string.Empty)
                           .Select(schedule =>
                    {
                        string securedUri;

                        try
                        {
                            securedUri = new Uri(schedule.InboxWorkQueueUri).Secured().ToString();
                        }
                        catch
                        {
                            securedUri = "(invalid uri)";
                        }

                        return new
                        {
                            DataStoreId = dataStoreId,
                            schedule.Id,
                            schedule.Name,
                            schedule.InboxWorkQueueUri,
                            SecuredUri = securedUri,
                            schedule.CronExpression,
                            schedule.NextNotification
                        };
                    })
                }));
            }
        }