Skip to content

Commit

Permalink
Pinpoint Channel testing
Browse files Browse the repository at this point in the history
  • Loading branch information
docwho2 committed Jan 8, 2024
1 parent 6978e8b commit 4a4059d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.amazonaws.services.lambda.runtime.events.LexV2Response;
import com.amazonaws.services.lambda.runtime.events.SNSEvent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.concurrent.CompletionException;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down Expand Up @@ -42,8 +43,14 @@ public Void handleRequest(SNSEvent input, Context cntxt) {
log.debug("Recieved SNS Event" + snsEvent);

// Convert payload to Pinpoint Event
final var ppe = mapper.convertValue(snsEvent.getMessage(), PinpointEvent.class);

PinpointEvent ppe;
try {
ppe = mapper.readValue(snsEvent.getMessage(), PinpointEvent.class);
} catch( JsonProcessingException jpe ) {
log.error("Cannot convert Pintpoint JSON to Object, processing aborted and returning null",jpe);
return null;
}

// Wrapped Event Class
final LexV2EventWrapper event = new LexV2EventWrapper(ppe);
LexV2Response response;
Expand Down

0 comments on commit 4a4059d

Please sign in to comment.