node.js - AWS Lambda: Can I return context and have a task still running? -
right have lambda function in production processes log strings , return them client, so:
1) string received lambda 2) lambda transforms string 3) lambda returns via context.succeed transformed string
now adding additional step save string in dynamodb table, workflow be:
1) string received lambda 2) lambda transforms string 3) lambda saves string dynamo 4) lambda returns via context.succeed transformed string
right bit saves function like:
function _saveitem (item) { dynamo.putitem(item, function (err, data) { //error handling here context.succeed(json.stringify(item)); }) }
i'd know if it's somehow possible fire putitem
function and, without waiting end, return item via context.succeed
i assume using "requestresponse" style invoke. true?
if want value returned right away can invoke lambda function (using "event" invoke), , have function write ddb, , return value.
the "event" invoke run asynchronously in background.
Comments
Post a Comment