This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>io.symphonia</groupId> | |
<artifactId>learning-lambda</artifactId> | |
<version>1.0-SNAPSHOT</version> |
This file contains hidden or 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
<configuration> | |
<appender name="STDOUT" class="io.symphonia.lambda.logging.DefaultConsoleAppender"> | |
<encoder> | |
<pattern>%msg%n</pattern> | |
</encoder> | |
</appender> | |
<root level="info"> | |
<appender-ref ref="STDOUT" /> | |
</root> | |
</configuration> |
This file contains hidden or 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 org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.lang.management.ManagementFactory; | |
import java.lang.management.RuntimeMXBean; | |
public class LoggingLambda { | |
private static final Logger LOG = LoggerFactory.getLogger(LoggingLambda.class); |
This file contains hidden or 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 StringIntegerBooleanLambda { | |
public String handlerString(String s) { | |
return "Hello, " + s; | |
} | |
public int handlerInt(int input) { | |
return 100 + input; | |
} |
This file contains hidden or 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.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
public class ListMapLambda { | |
public List<Integer> handlerList(List<Integer> input) { | |
List<Integer> newList = new ArrayList<>(); |
This file contains hidden or 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.getA()); | |
} | |
public static class PojoInput { | |
private String a; |
This file contains hidden or 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 Object handleRequest(S3Event input) { | |
// … | |
} |
This file contains hidden or 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.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
public class StreamLambda { | |
public void handlerStream(InputStream inputStream, OutputStream outputStream) throws IOException { | |
int letter; | |
while((letter = inputStream.read()) != -1) |
This file contains hidden or 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 com.amazonaws.services.lambda.runtime.Context; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class ContextLambda { | |
public Map<String,Object> handler (Object input, Context context) { | |
Map<String, Object> toReturn = new HashMap<>(); |
This file contains hidden or 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
<dependency> | |
<groupId>com.amazonaws</groupId> | |
<artifactId>aws-lambda-java-core</artifactId> | |
<version>1.1.0</version> | |
<scope>provided</scope> | |
</dependency> |