本文整理汇总了Java中com.amazonaws.services.lambda.runtime.RequestHandler类的典型用法代码示例。如果您正苦于以下问题:Java RequestHandler类的具体用法?Java RequestHandler怎么用?Java RequestHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RequestHandler类属于com.amazonaws.services.lambda.runtime包,在下文中一共展示了RequestHandler类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeLambda
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
private void invokeLambda(Class functionClass, ByteBuffer payload) throws IllegalAccessException, InstantiationException, InvocationTargetException, ExecutionException, InterruptedException {
Class lambdaPayloadClass = getLambdaPayloadClass(functionClass);
Object lambdaPayload = getPayloadObjectFromJson(payload, lambdaPayloadClass);
RequestHandler functionClassInstance = ((RequestHandler) functionClass.newInstance());
threadPool.submit(() -> functionClassInstance.handleRequest(lambdaPayload, new MockContext()));
}
示例2: handle
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void handle() {
final RequestHandler handler = mock(RequestHandler.class);
when(mockApplicationContext.getBean(RequestHandler.class)).thenReturn(handler);
final TestSpringVoidRequestHandler testHandler = new TestSpringVoidRequestHandler();
final Context mockContext = mock(Context.class);
final String input = "foo";
testHandler.handleRequest(input, mockContext);
verify(mockApplicationContext).getBean(RequestHandler.class);
verify(handler).handleRequest(input, mockContext);
}
示例3: handleEvent
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
private Optional<EventResultT> handleEvent(Supplier<Optional<EventT>> eventSupplier, Context context) {
return eventSupplier.get().map(e -> {
RequestHandler<EventT, EventResultT> handler = getEventHandler().get();
return handler.handleRequest(e, context);
});
}
示例4: getEventHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
@Override
public Supplier<RequestHandler<ScheduledEvent, ScheduledEventResult>> getEventHandler() {
return () -> new ScheduledEventHandler(getApplicationContext());
}
示例5: getEventHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
@Override
public Supplier<RequestHandler<SnsEvent, SnsEventResult>> getEventHandler() {
return () -> new SnsEventHandler(getApplicationContext());
}
示例6: getEventHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
@Override
public Supplier<RequestHandler<DynamoDbEvent, DynamoDbEventResult>> getEventHandler() {
return supplier;
}
示例7: getEventHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
@Override
public Supplier<RequestHandler<S3EventNotification, S3EventResult>> getEventHandler() {
return () -> new S3EventHandler(getApplicationContext(), s3Action);
}
示例8: SpringRequestHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
public SpringRequestHandler() {
handler = getApplicationContext().getBean(RequestHandler.class);
}
示例9: JacksonSpringRequestHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
/**
* To work around type erasure, pass the input type class here. AWS Lambda
* requires a no-arg constructor for their handler classes however, so be
* sure to provide one while calling this constructor in it.
*
* @param inputClass the class of this class's input type parameter, I.
*/
protected JacksonSpringRequestHandler(@NotNull final Class<I> inputClass) {
this.inputClass = inputClass;
this.handler = getApplicationContext().getBean(RequestHandler.class);
}
示例10: getEventHandler
import com.amazonaws.services.lambda.runtime.RequestHandler; //导入依赖的package包/类
Supplier<RequestHandler<EventT, R>> getEventHandler();