Make `GenericAWSRequestHandler` do the JSON deserialization and handler calling
The raw JSON data is passed in the entry point implements RequestStreamHandler. Since this gives access to the raw JSON data, we can handle JSON deserialization ourselves and then support calling into either RequestHandler or just forwarding the streams to RequestStreamHandler.
This will have the advantage of doing JSON deserialization any way we want rather than forcing how Amazon does it.
This will break compatibility if any other code uses GenericAWSRequestHandler as a RequestHandler (a wrapper on top of IOpipe?).
This should be researched.
I had a thought that compatibility is no issue at all, these are two different interfaces and they can be implemented since they provide two different methods (they have different descriptors). This means:
- Does not break compatibility.
-
GenericAWSRequestHandlerimplements bothRequestHandlerandRequestStreamHandler. - AWS should prefer the stream based handler, which may be faster.
- Existing code that uses
RequestHandlerit will still work. - The generic handler, at least the code being used, I believe the library it uses serializes to JSON then deserializes that to the target object. If this is actually how it works, then this would reduce latency to handling the events.
If this is done, then there would have to be an internal extra method which forwards to the desired code to be executed, to prevent the input object being processed multiple times.