Ejemplo n.º 1
0
        public async Task InvokeAsync()
        {
            XRayTracing.Configure();

            try
            {
                await HandleAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public async Task InvokeAsync(SQSEvent @event)
        {
            XRayTracing.Configure();

            try
            {
                var sqsMessage = @event.Records.Single();

                var deserializedMessage = JsonSerializer.Deserialize <T>(sqsMessage.Body);

                await HandleAsync(deserializedMessage);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task InvokeAsync(TRequest request, ILambdaContext lambdaContext)
        {
            XRayTracing = new XRayTracing();

            LambdaContext = lambdaContext;
            Logger        = new MyLogger(LambdaContext);

            try
            {
                await HandleAsync(request);
            }
            catch (Exception ex)
            {
                Logger.Log("Unhandled exception occured.", "ERROR", ex);
                throw;
            }
            finally
            {
                XRayTracing.EmitLambdaSegmentsIfNeeded();
            }
        }
Ejemplo n.º 4
0
        private static ItemMessage ExtractItemMessage(SQSEvent sqsEvent, ILambdaContext lambdaContext, XRayTracing xRayTracing)
        {
            var sqsMessage = sqsEvent.Records.Single();

            xRayTracing.RewriteTraceContext(sqsMessage, lambdaContext);

            var itemMessage = JsonSerializer.Deserialize <ItemMessage>(sqsMessage.Body);

            return(itemMessage);
        }