AWS Simple Email Service - Java Receive Lambda & STOP_RULE

 ̄綄美尐妖づ 提交于 2021-01-29 11:28:16

问题


What would I return from a Java SES receiving lambda to cause the rules to stop?

AWS provide examples in Node, but what would this look like in Java?

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html

exports.handler = function(event, context, callback) {
        ...
        // Stop processing rule set, dropping message
        callback(null, {'disposition':'STOP_RULE'});
    } else {
        callback(null, null);   
    }
};

How would I do this with the Java SDK though?

@Override
public Object handleRequest(Object request, Context context) {
    //Return what?
}

Simply returning the String "STOP_RULE" doesn't work.


回答1:


It appears that the Java SDK works the same ways as Node. The difference been that the SDK must use Jackson to serialize the objects on the way out. Returning JSON Strings won't work, but objects will:

return Collections.singletonMap("disposition", "STOP_RULE");


来源:https://stackoverflow.com/questions/56581664/aws-simple-email-service-java-receive-lambda-stop-rule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!