public void GivenIUpdateTheDeliveryStatusOfTheNotificationCalledToForTheDeliveryChannelAndCallIt(
            string originalName,
            UserNotificationDeliveryStatus deliveryStatus,
            string deliveryChannelId,
            string newName)
        {
            UserNotification notification        = this.scenarioContext.Get <UserNotification>(originalName);
            UserNotification updatedNotification = notification.WithChannelDeliveryStatus(deliveryChannelId, deliveryStatus, DateTimeOffset.UtcNow);

            this.scenarioContext.Set(updatedNotification, newName);
        }
Пример #2
0
        private async Task UpdateNotificationDeliveryStatusAsync(string deliveryChannelId, string notificationId, UserNotificationDeliveryStatus deliveryStatus, ITenant tenant, string?failureMessage = null)
        {
            IUserNotificationStore store = await this.notificationStoreFactory.GetUserNotificationStoreForTenantAsync(tenant).ConfigureAwait(false);

            UserNotification originalNotification = await store.GetByIdAsync(notificationId).ConfigureAwait(false);

            UserNotification modifiedNotification = originalNotification.WithChannelDeliveryStatus(
                deliveryChannelId,
                deliveryStatus,
                DateTimeOffset.UtcNow,
                failureMessage);

            await store.StoreAsync(modifiedNotification).ConfigureAwait(false);
        }
Пример #3
0
        public async Task ExecuteAsync(
            [ActivityTrigger] IDurableActivityContext context,
            ILogger logger)
        {
            TenantedFunctionData <BatchDeliveryStatusUpdateRequestItem> request = context.GetInput <TenantedFunctionData <BatchDeliveryStatusUpdateRequestItem> >();

            ITenant tenant = await this.tenantProvider.GetTenantAsync(request.TenantId).ConfigureAwait(false);

            logger.LogInformation(
                "Executing UpdateNotificationDeliveryStatusActivity for notification with Id {notificationId}",
                request.Payload.NotificationId);

            IUserNotificationStore store = await this.notificationStoreFactory.GetUserNotificationStoreForTenantAsync(tenant).ConfigureAwait(false);

            UserNotification originalNotification = await store.GetByIdAsync(request.Payload.NotificationId).ConfigureAwait(false);

            UserNotification modifiedNotification = originalNotification.WithChannelDeliveryStatus(
                request.Payload.DeliveryChannelId,
                request.Payload.NewStatus,
                request.Payload.UpdateTimestamp);

            await store.StoreAsync(modifiedNotification).ConfigureAwait(false);
        }