MCPcopy Index your code
hub / github.com/aws/aws-lambda-rust-runtime / invoke

Method invoke

examples/extension-internal-flush/src/main.rs:24–48  ·  view source on GitHub ↗
(&self, event: lambda_extension::LambdaEvent)

Source from the content-addressed store, hash-verified

22 }
23
24 pub async fn invoke(&self, event: lambda_extension::LambdaEvent) -> Result<(), Error> {
25 match event.next {
26 // NB: Internal extensions only support the INVOKE event.
27 NextEvent::Shutdown(shutdown) => {
28 return Err(anyhow!("extension received unexpected SHUTDOWN event: {:?}", shutdown).into());
29 }
30 NextEvent::Invoke(_e) => {}
31 }
32
33 eprintln!("[extension] waiting for event to be processed");
34
35 // Wait for runtime to finish processing event.
36 self.request_done_receiver
37 .lock()
38 .await
39 .recv()
40 .await
41 .ok_or_else(|| anyhow!("channel is closed"))?;
42
43 eprintln!("[extension] flushing logs and telemetry");
44
45 // <flush logs and telemetry here>
46
47 Ok(())
48 }
49}
50
51/// Object that you send to SQS and plan to process with the function.

Callers 1

mainFunction · 0.80

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected