public async Task Run(
            [ServiceBusTrigger(
                 "%QueueListenerNameForDequeue%",
                 Connection = "ServiceBusConnectionString")]
            byte[] message,
            FunctionContext context)
        {
            var logger = context.GetLogger("ReplyToRequestFromPostOffice");

            logger.LogInformation("C# ServiceBus ReplyToDequeueFromPostOffice triggered");

            try
            {
                var dequeueNotification          = _dequeueNotificationParser.Parse(message);
                var dataAvailableNotificationIds = await _storageHandler
                                                   .GetDataAvailableNotificationIdsAsync(dequeueNotification)
                                                   .ConfigureAwait(false);

                logger.LogInformation($"Dequeue received for {dequeueNotification.MarketOperator.Value} with notification ids: {string.Join(",", dataAvailableNotificationIds)}");
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("Could not process message.", e);
            }
        }
Exemplo n.º 2
0
        private async Task <DataBundleResponseDto> CreateResponseAsync(DataBundleRequestDto requestDto)
        {
            var dataAvailableNotificationGuids = await _storageHandler
                                                 .GetDataAvailableNotificationIdsAsync(requestDto)
                                                 .ConfigureAwait(false);

            if (dataAvailableNotificationGuids.Contains(new Guid("0ae6c542-385f-4d89-bfba-d6c451915a1b")))
            {
                return(CreateFailedResponse(requestDto, DataBundleResponseErrorReason.DatasetNotFound));
            }
            if (dataAvailableNotificationGuids.Contains(new Guid("3cfce64e-aa1d-4003-924d-69c8739e73a6")))
            {
                return(CreateFailedResponse(requestDto, DataBundleResponseErrorReason.DatasetNotAvailable));
            }
            if (dataAvailableNotificationGuids.Contains(new Guid("befdcf5a-f58d-493b-9a17-e5231609c8f6")))
            {
                return(CreateFailedResponse(requestDto, DataBundleResponseErrorReason.InternalError));
            }

            return(await CreateSuccessResponseAsync(requestDto, dataAvailableNotificationGuids).ConfigureAwait(false));
        }