[英]AWS SNS stopped delivering messages
我尝试从 AWS SNS API 到 JAVA 发送 SMS,它工作了两天,然后突然停止传递消息,但是来自 API 的响应是 200 ok,具有正确的消息 ID,但没有传递消息。 我试图通过 postman 发布请求以更清楚地了解问题,但找不到任何集合或请求签名。
`
public class SNS {
public static void sendSMS(String phoneNumber,String message)
{
BasicAWSCredentials basicCred = new BasicAWSCredentials("XXXXXXXXXXX", "XXXXXXXXXXXXX");
AmazonSNSClient snsClient = (AmazonSNSClient) AmazonSNSClientBuilder.standard()
.withClientConfiguration(
new ClientConfiguration()
.withMaxErrorRetry(0)
.withConnectionTimeout(1000))
.withCredentials(new AWSStaticCredentialsProvider(basicCred))
.withRegion("us-east-1")
.build();
Map<String, MessageAttributeValue> smsAttributes =
new HashMap<String, MessageAttributeValue>();
smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue()
.withStringValue("Sender") //The sender ID shown on the device.
.withDataType("String"));
smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue()
.withStringValue("Transactional") //Sets the type to Transactional.
.withDataType("String"));
sendSMSMessage(snsClient, message, phoneNumber, smsAttributes);
}
public static void sendSMSMessage(AmazonSNSClient snsClient, String message,
String phoneNumber, Map<String, MessageAttributeValue> smsAttributes)
{
PublishResult result = snsClient.publish(new PublishRequest()
.withMessage(message)
.withPhoneNumber(phoneNumber)
.withMessageAttributes(smsAttributes));
}
public static void main(String[] args) {
sendSMS("+91XXXXXXXXXX", "Hi This is Test message from SNS");
}
}`
我正在使用上面的代码,它给出了 200 O 作为响应以及请求和消息 ID,但消息没有传递。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.