public static void Run([ServiceBusTrigger(ApplicationConstants.TargetClaimQueueName, Connection = "MyConn")] string queueItem,
                               Int32 deliveryCount, DateTime enqueuedTimeUtc, string messageId, ILogger log, ExecutionContext context)
        {
            log.LogInformation($"Claim validation content: {queueItem}");
            var config            = CoreConfiguration.BuildAppConfig(context);
            var connectionString  = config[ApplicationConstants.StorageConnectionString];
            var userClaimFormData = MessageConverter.Deserialize <ClaimForm>(queueItem);

            ProcessMessage(userClaimFormData, connectionString, "claimTable");
        }
Example #2
0
        public static async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log, ExecutionContext context)
        {
            var config = CoreConfiguration.BuildAppConfig(context);
            var messageConnectionString = config[ApplicationConstants.StorageConnectionString];

            if (messageConnectionString == null)
            {
                return(new BadRequestObjectResult(ErroSubmittingClaimMessage));
            }

            var userClaimFormData = await MessageConverter.Deserialize <ClaimForm>(req.Body);

            var sender = new MessageSender(messageConnectionString, ApplicationConstants.TargetClaimQueueName);
            await sender.SendAsync(CreateMessage(userClaimFormData));

            return(userClaimFormData != null
                ? (ActionResult) new OkObjectResult(ClaimSubmissionSuccessful)
                : new BadRequestObjectResult(ErroSubmittingClaimMessage));
        }