Class CompositeHandler
- java.lang.Object
-
- com.amazonaws.athena.connector.lambda.handlers.CompositeHandler
-
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestStreamHandler
- Direct Known Subclasses:
AmazonMskCompositeHandler
,AwsCmdbCompositeHandler
,BigQueryCompositeHandler
,ClickHouseCompositeHandler
,CloudwatchCompositeHandler
,DataLakeGen2CompositeHandler
,Db2As400CompositeHandler
,Db2CompositeHandler
,DocDBCompositeHandler
,DynamoDBCompositeHandler
,ElasticsearchCompositeHandler
,ExampleCompositeHandler
,GcsCompositeHandler
,HbaseCompositeHandler
,HiveCompositeHandler
,HiveCompositeHandler
,ImpalaCompositeHandler
,KafkaCompositeHandler
,MetricsCompositeHandler
,MultiplexingJdbcCompositeHandler
,MySqlCompositeHandler
,NeptuneCompositeHandler
,OracleCompositeHandler
,PostGreSqlCompositeHandler
,RedisCompositeHandler
,SaphanaCompositeHandler
,SnowflakeCompositeHandler
,SqlServerCompositeHandler
,SynapseCompositeHandler
,TeradataCompositeHandler
,TimestreamCompositeHandler
,TPCDSCompositeHandler
,VerticaCompositeHandler
public class CompositeHandler extends Object implements com.amazonaws.services.lambda.runtime.RequestStreamHandler
This class allows you to have a single Lambda function be responsible for both metadata and data operations by composing a MetadataHandler with a RecordHandler and muxing requests to the appropriate class. You might choose to use this CompositeHandler to run a single lambda function for the following reasons: 1. Can be simpler to deploy and manage a single vs multiple Lambda functions 2. You don't need to independently control the cost or performance of metadata vs. data operations.- See Also:
RequestStreamHandler
-
-
Constructor Summary
Constructors Constructor Description CompositeHandler(MetadataHandler metadataHandler, RecordHandler recordHandler)
Basic constructor that composes a MetadataHandler with a RecordHandler.CompositeHandler(MetadataHandler metadataHandler, RecordHandler recordHandler, UserDefinedFunctionHandler udfhandler)
Basic constructor that composes a MetadataHandler, RecordHandler, and a UserDefinedFunctionHandler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handleRequest(BlockAllocator allocator, FederationRequest rawReq, OutputStream outputStream, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Handles routing the request to the appropriate Handler, either MetadataHandler or RecordHandler.void
handleRequest(InputStream inputStream, OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context)
Required by Lambda's RequestStreamHandler interface.
-
-
-
Constructor Detail
-
CompositeHandler
public CompositeHandler(MetadataHandler metadataHandler, RecordHandler recordHandler)
Basic constructor that composes a MetadataHandler with a RecordHandler.- Parameters:
metadataHandler
- The MetadataHandler to delegate metadata operations to.recordHandler
- The RecordHandler to delegate data operations to.
-
CompositeHandler
public CompositeHandler(MetadataHandler metadataHandler, RecordHandler recordHandler, UserDefinedFunctionHandler udfhandler)
Basic constructor that composes a MetadataHandler, RecordHandler, and a UserDefinedFunctionHandler- Parameters:
metadataHandler
- The MetadataHandler to delegate metadata operations to.recordHandler
- The RecordHandler to delegate data operations to.udfhandler
- The UserDefinedFunctionHandler to delegate UDF operations to.
-
-
Method Detail
-
handleRequest
public final void handleRequest(InputStream inputStream, OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context) throws IOException
Required by Lambda's RequestStreamHandler interface. In our case we use this method to handle some basic resource lifecycle tasks for the request, namely the BlockAllocator and the request object itself.- Specified by:
handleRequest
in interfacecom.amazonaws.services.lambda.runtime.RequestStreamHandler
- Throws:
IOException
-
handleRequest
public final void handleRequest(BlockAllocator allocator, FederationRequest rawReq, OutputStream outputStream, com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws Exception
Handles routing the request to the appropriate Handler, either MetadataHandler or RecordHandler.- Parameters:
allocator
- The BlockAllocator to use for Apache Arrow Resources.rawReq
- The request object itself.outputStream
- The OutputStream to which all responses should be written.objectMapper
- The ObjectMapper that can be used for serializing responses.- Throws:
Exception
-
-