From bf140461d35f772415693dd486fed5b4bf21b73b Mon Sep 17 00:00:00 2001 From: "Moellering, Sascha" Date: Wed, 21 Feb 2018 13:53:54 +0100 Subject: [PATCH] Simplified Lambda functions --- .../src/main/java/com/amazon/KinesisConsumerHandler.java | 6 +++--- .../src/main/java/com/amazon/RedisUpdaterHandler.java | 9 ++++----- .../src/test/java/com/amazon/RedisUpdaterTest.java | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/services/kinesis-consumer/src/main/java/com/amazon/KinesisConsumerHandler.java b/services/kinesis-consumer/src/main/java/com/amazon/KinesisConsumerHandler.java index 5808c7c..2f0a752 100644 --- a/services/kinesis-consumer/src/main/java/com/amazon/KinesisConsumerHandler.java +++ b/services/kinesis-consumer/src/main/java/com/amazon/KinesisConsumerHandler.java @@ -31,11 +31,11 @@ import java.nio.ByteBuffer; -public class KinesisConsumerHandler implements RequestHandler { +public class KinesisConsumerHandler { private DynamoDB dynamoDB; - public Void handleRequest(KinesisEvent kinesisEvent, Context context) { + public void handleRequest(KinesisEvent kinesisEvent, Context context) { LambdaLogger logger = context.getLogger(); @@ -81,7 +81,7 @@ public Void handleRequest(KinesisEvent kinesisEvent, Context context) { } } - return null; + return; } private AmazonDynamoDB createDynamodbClient(final Region region) { diff --git a/services/redis-updater/src/main/java/com/amazon/RedisUpdaterHandler.java b/services/redis-updater/src/main/java/com/amazon/RedisUpdaterHandler.java index 004cf5c..7600695 100644 --- a/services/redis-updater/src/main/java/com/amazon/RedisUpdaterHandler.java +++ b/services/redis-updater/src/main/java/com/amazon/RedisUpdaterHandler.java @@ -30,14 +30,13 @@ import static com.amazon.util.Constants.REDIS_HOST; import static com.amazon.util.Constants.REDIS_PORT; -public class RedisUpdaterHandler implements RequestHandler { +public class RedisUpdaterHandler { private Jedis jedis; private Charset charset = Charset.forName("UTF-8"); private ObjectMapper mapper = new ObjectMapper(); - @Override - public Void handleRequest(KinesisEvent kinesisEvent, Context context) { + public void handleRequest(KinesisEvent kinesisEvent, Context context) { RedisUpdater redisUpdater = new RedisUpdater(); LambdaLogger logger = context.getLogger(); @@ -50,7 +49,7 @@ public Void handleRequest(KinesisEvent kinesisEvent, Context context) { if (System.getenv(REDIS_HOST) == null) { logger.log("Not Redis host specified"); - return null; + return; } String redisHost = System.getenv(REDIS_HOST); int redisPort = System.getenv(REDIS_PORT) == null ? 6379 : Integer.parseInt(System.getenv(REDIS_PORT)); @@ -77,7 +76,7 @@ public Void handleRequest(KinesisEvent kinesisEvent, Context context) { } } - return null; + return; } diff --git a/services/redis-updater/src/test/java/com/amazon/RedisUpdaterTest.java b/services/redis-updater/src/test/java/com/amazon/RedisUpdaterTest.java index ea44f4b..44538d4 100644 --- a/services/redis-updater/src/test/java/com/amazon/RedisUpdaterTest.java +++ b/services/redis-updater/src/test/java/com/amazon/RedisUpdaterTest.java @@ -143,6 +143,4 @@ public void writeToRedisTest() { exc.printStackTrace(); } } - - }