com.amazonaws.services.lambda.runtime.RequestStreamHandler Java Examples

The following examples show how to use com.amazonaws.services.lambda.runtime.RequestStreamHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractMicronautLambdaRuntime.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @throws ConfigurationException if the handler is not of type RequestHandler or RequestStreamHandler
 */
protected void validateHandler() throws ConfigurationException {
    if (handler == null) {
        throw new ConfigurationException("no handler instantiated. Override either createHandler() or createRequestStreamHandler() or annotate your Handler class with @Introspected");
    }
    if (!(handler instanceof RequestHandler || handler instanceof RequestStreamHandler)) {
        throw new ConfigurationException("handler must be of type com.amazonaws.services.lambda.runtime.RequestHandler or com.amazonaws.services.lambda.runtime.RequestStreamHandler");
    }
}
 
Example #2
Source File: AbstractMicronautLambdaRuntime.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param args Command Line Args
 * @return if {@link AbstractMicronautLambdaRuntime#createHandler(String...)} or {@link AbstractMicronautLambdaRuntime#createRequestStreamHandler(String...)} are implemented, it returns the handler returned by those methods. If they are not, it attempts to instantiate the class
 * referenced by the environment variable {@link ReservedRuntimeEnvironmentVariables#HANDLER} via Introspection. Otherwise, it returns {@code null}.
 */
@Nullable
protected Object createHandler(String... args) {
    RequestHandler<HandlerRequestType, HandlerResponseType> requestHandler = createRequestHandler(args);
    if (requestHandler != null) {
        return requestHandler;
    }
    RequestStreamHandler requestStreamHandler = createRequestStreamHandler(args);
    if (requestStreamHandler != null) {
        return requestStreamHandler;
    }
    return createEnvironmentHandler();
}
 
Example #3
Source File: AmazonLambdaRecorder.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void setStreamHandlerClass(Class<? extends RequestStreamHandler> handler, BeanContainer container) {
    streamHandlerClass = handler;
    beanContainer = container;
}
 
Example #4
Source File: SpringRequestStreamHandler.java    From spring-aws-lambda with MIT License 4 votes vote down vote up
public SpringRequestStreamHandler() {
    this.handler = getApplicationContext().getBean(RequestStreamHandler.class);
}
 
Example #5
Source File: AbstractMicronautLambdaRuntime.java    From micronaut-aws with Apache License 2.0 2 votes vote down vote up
/**
 *
 * @param args Command Line Args
 * @return a {@link RequestStreamHandler} or {@code null}.
 */
@Nullable
protected RequestStreamHandler createRequestStreamHandler(String... args) {
    return null;
}