class SQSMessageProcessor implements Function<SQSMessageProcessorRequest, SQSMessageProcessorResponse> {

    @Override
    public SQSMessageProcessorResponse apply(final SQSMessageProcessorRequest request) {
        List<SQSMessageResult> messageResults = request.getMessages().stream()
                .map(this::processMessage)
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
        return new SQSMessageProcessorResponse(messageResults);
    }

}