示例#1
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "SubmitSignering/{id}")]
            HttpRequestMessage req,
            [OrchestrationClient] DurableOrchestrationClient client,
            [Table("Signeringer", "Signering", "{id}", Connection = "AzureWebJobsStorage")] TableStoreItem signering,
            TraceWriter log)
        {
            log.Info(" ");
            log.Info("C# HTTP trigger function processed a request.");

            // nb if the signering code doesn't exist, framework just returns a 404 before we get here
            string result = req.GetQueryNameValuePairs()
                            .FirstOrDefault(q => string.Compare(q.Key, "result", true) == 0).Value;

            if (result == null)
            {
                return(req.CreateResponse(HttpStatusCode.BadRequest, "Trenger et signeringsresultat"));
            }


            log.Warning($"Sending Signerings Resultat to {signering.OrchestrationId} of {result}");

            // send the SigneringsResult external event to this orchestration
            await client.RaiseEventAsync(signering.OrchestrationId, "SigneringsResult", result);

            return(req.CreateResponse(HttpStatusCode.OK, "Signeringsresultat mottatt"));
        }
示例#2
0
        public static void SendSignMessageToService(
            [ActivityTrigger] SigneringsInfo signeringsInfo,
            [Table("Signeringer", "AzureWebJobsStorage")] out TableStoreItem signering,
            TraceWriter log)
        {
            log.Info(" ");
            log.Info($"Sender melding til signeringsservice om signeringer for OrchestrationId: {signeringsInfo.OrchestrationId}");

            var signeringsCode = Guid.NewGuid().ToString("N");

            signering = new TableStoreItem
            {
                PartitionKey    = "Signering",
                RowKey          = signeringsCode,
                OrchestrationId = signeringsInfo.OrchestrationId
            };

            log.Info($"Legger info om sigernering i Azure Table Storage: {signering}"); //TODO sjekk logg

            //TODO, hent fra konfig.: var host = ConfigurationManager.AppSettings["Host"];
            var host          = "http://localhost:7071";
            var signeringsurl = $"{host}/api/SubmitSignering/{signeringsCode}";

            log.Info($"Signerings url: {signeringsurl}"); //TODO sjekk logg

            //Lag en http trigger event fra service...
            //Som en midlertidig løsning legges denne i Postman
        }
示例#3
0
        public static void SendMeldingTilKontoService(
            [ActivityTrigger] InnbetalingsInfo innbetalingsInfo,
            [Table("Innbetalinger", "AzureWebJobsStorage")] out TableStoreItem aksjekap,
            TraceWriter log)
        {
            log.Info(" ");
            log.Info($"Sender melding til kontotjeneste for OrchestrationId: {innbetalingsInfo.OrchestrationId}");

            var code = Guid.NewGuid().ToString("N");

            aksjekap = new TableStoreItem
            {
                PartitionKey    = "Aksjekapital",
                RowKey          = code,
                OrchestrationId = innbetalingsInfo.OrchestrationId
            };

            log.Info($"Legger info om Innbetaling i Azure Table Storage: {aksjekap}"); //TODO sjekk logg

            //TODO, hent fra konfig.: var host = ConfigurationManager.AppSettings["Host"];
            var host = ConfigurationManager.AppSettings["Host"];
            // var host = "http://localhost:7071";
            var innbetalingsUrl = $"{host}/api/SubmitInnbetaling/{code}";

            log.Info($"Aksjekapital innbetalings url: {innbetalingsUrl}"); //TODO sjekk logg
            //Lag en http trigger event fra service...
            //Som en midlertidig løsning legges denne i Postman
        }