This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>com.amazonaws</groupId> | |
<artifactId>aws-java-sdk-core</artifactId> | |
<version>1.11.226</version> | |
</dependency> | |
</dependencies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyLambda { | |
private static final String containerId = java.util.UUID.randomUUID().toString(); | |
public String handler(String input) { | |
return "This is function instance " + containerId; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyLambda { | |
public String handler(Object input) { | |
return "Hello Lambda"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int containerExecutionCount = 0; | |
public void handler(Map<String, List<S3PutRecord>> input) { | |
final String key = input.get("Records").get(0).s3.object.key; | |
System.out.println("S3 PUT happened! Key was: " + key); | |
throw new RuntimeException("Throwing exception. This container has processed " + ++containerExecutionCount + " events"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.symphonia; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
public class WhatIsMyLambdaEvent { | |
public void handler(InputStream is, OutputStream os) { | |
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); | |
System.out.println(s.hasNext() ? s.next() : "No input detected"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void handler(S3Put input) { | |
final String key = input.Records.get(0).s3.object.key; | |
System.out.println("S3 PUT happened! Key was: " + key); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyLambda { | |
public void handler(S3Put input) { | |
// Execution code will go here | |
} | |
public static class S3Put { | |
public java.util.List<S3PutRecord> Records; | |
public static class S3PutRecord { | |
public S3PutRecordS3 s3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.symphonia; | |
public class MyLambda { | |
public void handler(String input) { | |
String message = String.format("Hello, %s!", input); | |
System.out.println(message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.symphonia; | |
public class MyLambda { | |
public String handler(String input) { | |
String message = String.format("Hello, %s!", input); | |
System.out.println("Logging: message"); | |
return message; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.symphonia; | |
public class PojoLambda { | |
public PojoResponse handlerPojo(PojoInput input) { | |
return new PojoResponse("Input was " + input.c); | |
} | |
public static class PojoInput { | |
public String c; | |
} |