AWS简单电子邮件服务-Java接收Lambda&STOP_RULE [英] AWS Simple Email Service - Java Receive Lambda & STOP_RULE

查看:81
本文介绍了AWS简单电子邮件服务-Java接收Lambda&STOP_RULE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将从接收到lambda的Java SES返回什么来导致规则停止?

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

AWS在Node中提供了示例,但是在Java中会是什么样?

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);   
    }
};

我该如何使用Java SDK?

How would I do this with the Java SDK though?

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

仅返回字符串"STOP_RULE"不起作用.

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

推荐答案

看来,Java SDK与Node的工作方式相同.区别在于,SDK必须使用Jackson来在出局时序列化对象.返回JSON字符串将不起作用,但是对象将:

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");

这篇关于AWS简单电子邮件服务-Java接收Lambda&STOP_RULE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆