Skip to content

Commit

Permalink
Alexa SkillStreamHandler subclass check for RequestStreamHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
oztimpower committed Mar 19, 2020
1 parent 08972b0 commit d9d2d37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<aws-lambda-serverless-java-container.version>1.3.1</aws-lambda-serverless-java-container.version>
<aws-xray.version>2.4.0</aws-xray.version>
<awssdk.version>2.10.70</awssdk.version>
<aws-asksdk.version>2.28.0</aws-asksdk.version>
<azure-functions-java-library.version>1.3.0</azure-functions-java-library.version>
<kotlin.version>1.3.61</kotlin.version>
<dekorate.version>0.11.3</dekorate.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public final class AmazonLambdaProcessor {

private static final DotName REQUEST_HANDLER = DotName.createSimple(RequestHandler.class.getName());
private static final DotName REQUEST_STREAM_HANDLER = DotName.createSimple(RequestStreamHandler.class.getName());
private static final DotName SKILL_STREAM_HANDLER = DotName.createSimple("com.amazon.ask.SkillStreamHandler");

private static final DotName NAMED = DotName.createSimple(Named.class.getName());
private static final Logger log = Logger.getLogger(AmazonLambdaProcessor.class);
Expand All @@ -70,11 +71,13 @@ List<AmazonLambdaBuildItem> discover(CombinedIndexBuildItem combinedIndexBuildIt
BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemBuildProducer,
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer) throws BuildException {

Collection<ClassInfo> allKnownImplementors = combinedIndexBuildItem.getIndex().getAllKnownImplementors(REQUEST_HANDLER);
Collection<ClassInfo> allKnownStreamImplementors = combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(REQUEST_STREAM_HANDLER);
allKnownImplementors.addAll(combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(REQUEST_STREAM_HANDLER));
allKnownImplementors.addAll(combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(SKILL_STREAM_HANDLER));

allKnownImplementors.addAll(allKnownStreamImplementors);
if (allKnownImplementors.size() > 0 && providedLambda.isPresent()) {
throw new BuildException(
"Multiple handler classes. You have a custom handler class and the " + providedLambda.get().getProvider()
Expand Down

0 comments on commit d9d2d37

Please sign in to comment.