BAEL-549: AWS Lambda (#932)

This commit is contained in:
Sunil Gulabani
2016-12-29 23:16:46 +05:30
committed by maibin
parent fa50144eef
commit 2c99d93c3f
4 changed files with 83 additions and 0 deletions
@@ -0,0 +1,10 @@
package com.baeldung;
import com.amazonaws.services.lambda.runtime.Context;
public class LambdaMethodHandler {
public String handleRequest(String input, Context context) {
context.getLogger().log("Input: " + input);
return "Hello World - " + input;
}
}
@@ -0,0 +1,11 @@
package com.baeldung;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class LambdaRequestHandler implements RequestHandler<String, String> {
public String handleRequest(String input, Context context) {
context.getLogger().log("Input: " + input);
return "Hello World - " + input;
}
}
@@ -0,0 +1,18 @@
package com.baeldung;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class LambdaRequestStreamHandler implements RequestStreamHandler {
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
String input = IOUtils.toString(inputStream, "UTF-8");
outputStream.write(("Hello World - " + input).getBytes());
}
}