Skip to content

Instantly share code, notes, and snippets.

@civic
Created February 17, 2024 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save civic/2a0583b19d6260832ba5e6ab98b25702 to your computer and use it in GitHub Desktop.
Save civic/2a0583b19d6260832ba5e6ab98b25702 to your computer and use it in GitHub Desktop.
StudyLambda1 初期化処理あり
package com.example;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.SQSEvent;
import java.util.UUID;
public class StudyLambda1 implements RequestHandler<SQSEvent, Void>, Resource {
private static final String hogeSeed;
static {
hogeSeed = UUID.randomUUID().toString();
}
public Void handleRequest(SQSEvent input, Context context) {
System.out.printf("function start. input=[%s] hogeSeed=[%s]%n",
input.getRecords().get(0).getBody(), hogeSeed);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
System.out.println("function finish.");
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment