java - what wrong with my AWS Lambda creating project? -
hey downloaed tools aws toolkit required eclipse, , new im trying create new aws lambda project , give package, project name , change input type custom provide string input type , out type, after loading creates project comes errors so, please can tell what's wrong??
package com.amazonaws.lambda.demo; import com.amazonaws.services.lambda.runtime.context; import com.amazonaws.services.lambda.runtime.requesthandler; public class lambdafunctionhandler implements requesthandler<string, string> { @override public string handlerequest(string input, context context) // error hanlerequest states multiple markers @ line - method handlerequest(string, context) of type lambdafunctionhandler must override superclass method - implements { context.getlogger().log("input: " + input); // todo: implement handler return null; } } }
the aws documentation outdated.
you need implement different interface.
passing map:
public class myhandler implements requesthandler<map<string,object>,string>
passing custom pojo object:
public class myhandler implements requesthandler<customrequest,customresponse> {
consuming stream:
public class myhandler implements requeststreamhandler {
make sure grab right dependency:
<dependency> <groupid>com.amazonaws</groupid> <artifactid>aws-lambda-java-core</artifactid> <version>1.1.0</version> </dependency>
i developed sample application implementing each of interfaces. can clone github. 1 of handlers print out available environment variables well.
lambda expects json input.
Comments
Post a Comment