public abstract class SkillStreamHandler extends Object implements com.amazonaws.services.lambda.runtime.RequestStreamHandler
Lambda functions written in Java must have a RequestStreamHandler
class for the handler.
That handler must include a zero argument constructor and implement RequestStreamHandler
.
The SkillStreamHandler
abstract class can be used to create such a class that extends
RequestStreamHandler
When configuring your Lambda function in the AWS Lambda console, specify your new class as the Handler.
Constructor and Description |
---|
SkillStreamHandler(AlexaSkill... skills)
Constructor to build an instance of
SkillStreamHandler with multiple Alexa skills. |
SkillStreamHandler(AlexaSkill skill)
Constructor to build an instance of
SkillStreamHandler with a single Alexa skill. |
Modifier and Type | Method and Description |
---|---|
void |
handleRequest(InputStream input,
OutputStream output,
com.amazonaws.services.lambda.runtime.Context context)
This method is the primary entry point when executing your Lambda function.
|
public SkillStreamHandler(AlexaSkill skill)
SkillStreamHandler
with a single Alexa skill.skill
- instance of type AlexaSkill
.public SkillStreamHandler(AlexaSkill... skills)
SkillStreamHandler
with multiple Alexa skills.skills
- instances of type AlexaSkill
.public final void handleRequest(InputStream input, OutputStream output, com.amazonaws.services.lambda.runtime.Context context) throws IOException
SkillStreamHandler
determines the type of request and passes the request to
the configured Skill
.
Any errors that occur in either the Skill
or the SkillStreamHandler
are converted into a RuntimeException
, causing the Lambda call to fail. Details on
the failure are then available in the Lambda console logs within CloudWatch.
handleRequest
in interface com.amazonaws.services.lambda.runtime.RequestStreamHandler
IOException
Copyright © 2023. All rights reserved.