1 Answer
- Newest
- Most votes
- Most comments
0
Hi Brian,
One approach is to try to find a common “parent” to all those event types. As everything is an object in Java, you could argue that your handler could accept Object type as the event.
The drawback is that then you ll have to cast and use instanceof operator, not ideal but it will work.
Another approach is to use Map and/or Inputstream as shown here: https://docs.aws.amazon.com/lambda/latest/dg/java-handler.html.
Hope it helps
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
Using Object and instanceof does work, but isn’t really a lot different than having a handler per event type. The issue with the Map or InputStream is that the event is serialized and I have essentially the same problem as before in that each event has a different format. :(