io.quarkus.funqy.lambda.event.EventProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-funqy-amazon-lambda Show documentation
Show all versions of quarkus-funqy-amazon-lambda Show documentation
Amazon Lambda Binding for Quarkus Funqy framework
The newest version!
package io.quarkus.funqy.lambda.event;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import org.jboss.logging.Logger;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.events.DynamodbEvent;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent;
import com.amazonaws.services.lambda.runtime.events.SNSEvent;
import com.amazonaws.services.lambda.runtime.events.SQSEvent;
import com.fasterxml.jackson.databind.ObjectReader;
import io.quarkus.funqy.lambda.FunqyResponseImpl;
import io.quarkus.funqy.lambda.config.FunqyAmazonBuildTimeConfig;
import io.quarkus.funqy.lambda.config.FunqyAmazonConfig;
import io.quarkus.funqy.lambda.event.cloudevents.CloudEventsHandler;
import io.quarkus.funqy.lambda.event.dynamodb.DynamoDbEventHandler;
import io.quarkus.funqy.lambda.event.dynamodb.PipesDynamoDbEventHandler;
import io.quarkus.funqy.lambda.event.kinesis.KinesisEventHandler;
import io.quarkus.funqy.lambda.event.kinesis.PipesKinesisEventHandler;
import io.quarkus.funqy.lambda.event.sns.SnsEventHandler;
import io.quarkus.funqy.lambda.event.sqs.PipesSqsEventHandler;
import io.quarkus.funqy.lambda.event.sqs.SqsEventHandler;
import io.quarkus.funqy.lambda.model.cloudevents.CloudEventV1;
import io.quarkus.funqy.lambda.model.kinesis.PipesKinesisEvent;
import io.quarkus.funqy.runtime.FunqyServerResponse;
import io.smallrye.mutiny.Uni;
public class EventProcessor {
private static final Logger log = Logger.getLogger(EventProcessor.class);
private final ObjectReader objectReader;
private final FunqyAmazonConfig config;
private final Map, EventHandler, ?, ?>> eventHandlers;
public EventProcessor(final ObjectReader objectReader,
final FunqyAmazonBuildTimeConfig buildTimeConfig, final FunqyAmazonConfig config) {
this.objectReader = objectReader;
this.config = config;
this.eventHandlers = new HashMap<>();
if (buildTimeConfig.advancedEventHandling().enabled()) {
this.eventHandlers.put(SQSEvent.class, new SqsEventHandler());
this.eventHandlers.put(SQSEvent.SQSMessage.class, new PipesSqsEventHandler());
this.eventHandlers.put(SNSEvent.class, new SnsEventHandler());
this.eventHandlers.put(KinesisEvent.class, new KinesisEventHandler());
this.eventHandlers.put(PipesKinesisEvent.class, new PipesKinesisEventHandler());
this.eventHandlers.put(DynamodbEvent.class, new DynamoDbEventHandler());
this.eventHandlers.put(DynamodbEvent.DynamodbStreamRecord.class, new PipesDynamoDbEventHandler());
this.eventHandlers.put(CloudEventV1.class, new CloudEventsHandler());
}
}
public FunqyServerResponse handle(Object event,
Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy