Accessing AWS Lambda Context from Spring Cloud Function
up vote
0
down vote
favorite
I'm using Spring Cloud Function 1.0.0.RELEASE and the corresponding AWS adapter to run it in AWS lambda. Is there any way to retrieve the lambda function context from the Spring application context?
I know if you implement the RequestHandler interface yourself, then you get the Context object as the second parameter of the handleRequest method (see below), but since the SpringBootRequestHandler is handling this, it's not clear to me how to access the Context object. Any ideas?
Example of implementing RequestHandler directly
public class LambdaRequestHandler implements RequestHandler<String, String>
public String handleRequest(String input, Context context)
context.getLogger().log("Input: " + input);
return "Hello World - " + input;
Deferring the implementation of RequestHandler to SpringBootRequestHandler
public class SomeFunctionHandler
extends SpringBootRequestHandler<SomeRequest, SomeResponse>
amazon-web-services spring-boot aws-lambda spring-cloud
add a comment |
up vote
0
down vote
favorite
I'm using Spring Cloud Function 1.0.0.RELEASE and the corresponding AWS adapter to run it in AWS lambda. Is there any way to retrieve the lambda function context from the Spring application context?
I know if you implement the RequestHandler interface yourself, then you get the Context object as the second parameter of the handleRequest method (see below), but since the SpringBootRequestHandler is handling this, it's not clear to me how to access the Context object. Any ideas?
Example of implementing RequestHandler directly
public class LambdaRequestHandler implements RequestHandler<String, String>
public String handleRequest(String input, Context context)
context.getLogger().log("Input: " + input);
return "Hello World - " + input;
Deferring the implementation of RequestHandler to SpringBootRequestHandler
public class SomeFunctionHandler
extends SpringBootRequestHandler<SomeRequest, SomeResponse>
amazon-web-services spring-boot aws-lambda spring-cloud
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using Spring Cloud Function 1.0.0.RELEASE and the corresponding AWS adapter to run it in AWS lambda. Is there any way to retrieve the lambda function context from the Spring application context?
I know if you implement the RequestHandler interface yourself, then you get the Context object as the second parameter of the handleRequest method (see below), but since the SpringBootRequestHandler is handling this, it's not clear to me how to access the Context object. Any ideas?
Example of implementing RequestHandler directly
public class LambdaRequestHandler implements RequestHandler<String, String>
public String handleRequest(String input, Context context)
context.getLogger().log("Input: " + input);
return "Hello World - " + input;
Deferring the implementation of RequestHandler to SpringBootRequestHandler
public class SomeFunctionHandler
extends SpringBootRequestHandler<SomeRequest, SomeResponse>
amazon-web-services spring-boot aws-lambda spring-cloud
I'm using Spring Cloud Function 1.0.0.RELEASE and the corresponding AWS adapter to run it in AWS lambda. Is there any way to retrieve the lambda function context from the Spring application context?
I know if you implement the RequestHandler interface yourself, then you get the Context object as the second parameter of the handleRequest method (see below), but since the SpringBootRequestHandler is handling this, it's not clear to me how to access the Context object. Any ideas?
Example of implementing RequestHandler directly
public class LambdaRequestHandler implements RequestHandler<String, String>
public String handleRequest(String input, Context context)
context.getLogger().log("Input: " + input);
return "Hello World - " + input;
Deferring the implementation of RequestHandler to SpringBootRequestHandler
public class SomeFunctionHandler
extends SpringBootRequestHandler<SomeRequest, SomeResponse>
amazon-web-services spring-boot aws-lambda spring-cloud
amazon-web-services spring-boot aws-lambda spring-cloud
asked Nov 9 at 17:14
emerson
213
213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
SomeFunctionHandler
extends the SpringBootRequestHandler
, so it can override the handleRequest
method to get access to the AWS lambda Context
object.
public class SomeFunctionHandler extends SpringBootRequestHandler<SomeRequest, SomeResponse>
private static final Logger logger = LoggerFactory.getLogger(SomeFunctionHandler.class);
@Override
public Object handleRequest(SomeRequest event, Context context)
logger.info("ARN=" + context.getInvokedFunctionArn());
return super.handleRequest(event, context);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
SomeFunctionHandler
extends the SpringBootRequestHandler
, so it can override the handleRequest
method to get access to the AWS lambda Context
object.
public class SomeFunctionHandler extends SpringBootRequestHandler<SomeRequest, SomeResponse>
private static final Logger logger = LoggerFactory.getLogger(SomeFunctionHandler.class);
@Override
public Object handleRequest(SomeRequest event, Context context)
logger.info("ARN=" + context.getInvokedFunctionArn());
return super.handleRequest(event, context);
add a comment |
up vote
1
down vote
SomeFunctionHandler
extends the SpringBootRequestHandler
, so it can override the handleRequest
method to get access to the AWS lambda Context
object.
public class SomeFunctionHandler extends SpringBootRequestHandler<SomeRequest, SomeResponse>
private static final Logger logger = LoggerFactory.getLogger(SomeFunctionHandler.class);
@Override
public Object handleRequest(SomeRequest event, Context context)
logger.info("ARN=" + context.getInvokedFunctionArn());
return super.handleRequest(event, context);
add a comment |
up vote
1
down vote
up vote
1
down vote
SomeFunctionHandler
extends the SpringBootRequestHandler
, so it can override the handleRequest
method to get access to the AWS lambda Context
object.
public class SomeFunctionHandler extends SpringBootRequestHandler<SomeRequest, SomeResponse>
private static final Logger logger = LoggerFactory.getLogger(SomeFunctionHandler.class);
@Override
public Object handleRequest(SomeRequest event, Context context)
logger.info("ARN=" + context.getInvokedFunctionArn());
return super.handleRequest(event, context);
SomeFunctionHandler
extends the SpringBootRequestHandler
, so it can override the handleRequest
method to get access to the AWS lambda Context
object.
public class SomeFunctionHandler extends SpringBootRequestHandler<SomeRequest, SomeResponse>
private static final Logger logger = LoggerFactory.getLogger(SomeFunctionHandler.class);
@Override
public Object handleRequest(SomeRequest event, Context context)
logger.info("ARN=" + context.getInvokedFunctionArn());
return super.handleRequest(event, context);
answered Nov 12 at 14:55
emerson
213
213
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230452%2faccessing-aws-lambda-context-from-spring-cloud-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown