sms 短信服务说明

官网:https://help.aliyun.com/document_detail/57535.html

短信服务

api 短信发送流程

# 短信发送准备:短信签名、短信模板
AddSmsSign:添加短信签名,通过QuerySmsSign查看短信签名状态的审核状态
AddSmsTemplate:添加短信模板,通过QuerySmsTemplate查看短信模板的审核状态
说明:发送短信前需要先申请短信签名、短信模板,并确保短信签名以及模板已经审核通过发送测试短信可使用测试专用的签名、模板,免去了申请流程# 短信发送:单条发送、批量发送
SendSms:单条短信发送,短信群发(向最多1000个不用的手机号发送相同的内容,群发有一定延迟)
SendBatchSms:批量短信发送(向多个不同的手机号码发送不同签名和模板内容的短信)# 短信发送查询
QuerySendDetails:查询短信发送详情

相关依赖

        <!-- aliyun sms --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>aliyun-sms-spring-boot-starter</artifactId></dependency><dependencyManagement><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>${spring-boot.version}</version><type>pom</type><scope>import</scope></dependency><!-- aliyun上下文 --><dependency><groupId>com.alibaba.cloud</groupId><artifactId>aliyun-spring-boot-dependencies</artifactId><version>${aliyun-spring-boot.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement>

相关类与接口

SmsContextAutoConfiguration

@Configuration(proxyBeanMethods = false
)
@EnableConfigurationProperties({SmsProperties.class})   //创建SmsProperties配置bean
@ConditionalOnClass(name = {"com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest"}
)
@ConditionalOnProperty(name = {"alibaba.cloud.sms.enabled"},matchIfMissing = true
)
public class SmsContextAutoConfiguration {public SmsContextAutoConfiguration() {}
}

SmsProperties

@ConfigurationProperties(prefix = "alibaba.cloud.sms"
)
public class SmsProperties {public static final String SMS_PRODUCT = "Dysmsapi";public static final String SMS_DOMAIN = "dysmsapi.aliyuncs.com";private String reportQueueName;private String upQueueName;private String connectTimeout = "10000";private String readTimeout = "10000";public SmsProperties() {}

SmsAutoConfiguration

@Configuration(proxyBeanMethods = false
)
@EnableConfigurationProperties
@ConditionalOnClass({SendSmsRequest.class})
@ConditionalOnProperty(value = {"alibaba.cloud.sms.enabled"},matchIfMissing = true
)
public class SmsAutoConfiguration {public SmsAutoConfiguration() {}@Beanpublic SmsServiceImpl smsService(AliCloudProperties aliCloudProperties, SmsProperties smsProperties) {return new SmsServiceImpl(aliCloudProperties, smsProperties);}   //创建SmsServiceImpl@Beanpublic SmsInitializerEventListener smsInitializePostListener(SmsProperties smsProperties, ISmsService smsService) {return new SmsInitializerEventListener(smsProperties, smsService);}   //创建SmsInitializerEventListener
}

SmsServiceImpl:短信操作类,如发送、批量发送、查询发送详情等

public final class SmsServiceImpl extends AbstractSmsService {private static final Logger log = LoggerFactory.getLogger(SmsServiceImpl.class);private SmsProperties smsProperties;private AliCloudProperties aliCloudProperties;public SmsServiceImpl(AliCloudProperties aliCloudProperties, SmsProperties smsProperties) {this.aliCloudProperties = aliCloudProperties;this.smsProperties = smsProperties;}public SendSmsResponse sendSmsRequest(SendSmsRequest sendSmsRequest) throws ClientException {public SendSmsResponse sendSmsRequest(SendSmsRequest sendSmsRequest, String accessKeyId, String accessKeySecret) throws ServerException, ClientException {public boolean startSmsReportMessageListener(SmsReportMessageListener smsReportMessageListener) {String messageType = "SmsReport";String queueName = this.smsProperties.getReportQueueName();return this.startReceiveMsg(messageType, queueName, smsReportMessageListener);}public boolean startSmsUpMessageListener(SmsUpMessageListener smsUpMessageListener) {String messageType = "SmsUp";String queueName = this.smsProperties.getUpQueueName();return this.startReceiveMsg(messageType, queueName, smsUpMessageListener);}private boolean startReceiveMsg(String messageType, String queueName, SmsMessageListener messageListener) {public SendBatchSmsResponse sendSmsBatchRequest(SendBatchSmsRequest sendBatchSmsRequest) throws ServerException, ClientException {public SendBatchSmsResponse sendSmsBatchRequest(SendBatchSmsRequest sendBatchSmsRequest, String accessKeyId, String accessKeySecret) throws ClientException {public QuerySendDetailsResponse querySendDetails(QuerySendDetailsRequest request, String accessKeyId, String accessKeySecret) throws ClientException {public QuerySendDetailsResponse querySendDetails(QuerySendDetailsRequest request) throws ClientException {

AbstractSmsService

public abstract class AbstractSmsService implements ISmsService {private ConcurrentHashMap<String, IAcsClient> acsClientConcurrentHashMap = new ConcurrentHashMap();public AbstractSmsService() {}public IAcsClient getHangZhouRegionClientProfile(String accessKeyId, String accessKeySecret) {return (IAcsClient)this.acsClientConcurrentHashMap.computeIfAbsent(this.getKey("cn-hangzhou", accessKeyId, accessKeySecret), (iacsClient) -> {return new DefaultAcsClient(DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret));});}private String getKey(String regionId, String accessKeyId, String accessKeySecret) {return regionId + ":" + accessKeyId + ":" + accessKeySecret;}
}

ISmsService

public interface ISmsService {IAcsClient getHangZhouRegionClientProfile(String accessKeyId, String secret);SendSmsResponse sendSmsRequest(SendSmsRequest sendSmsRequest) throws ServerException, ClientException;SendSmsResponse sendSmsRequest(SendSmsRequest sendSmsRequest, String accessKeyId, String accessKeySecret) throws ServerException, ClientException;SendBatchSmsResponse sendSmsBatchRequest(SendBatchSmsRequest sendBatchSmsRequest) throws ServerException, ClientException;SendBatchSmsResponse sendSmsBatchRequest(SendBatchSmsRequest sendSmsRequest, String accessKeyId, String accessKeySecret) throws ServerException, ClientException;boolean startSmsReportMessageListener(SmsReportMessageListener smsReportMessageListener);boolean startSmsUpMessageListener(SmsUpMessageListener smsUpMessageListener);QuerySendDetailsResponse querySendDetails(QuerySendDetailsRequest request, String accessKeyId, String accessKeySecret) throws ClientException;QuerySendDetailsResponse querySendDetails(QuerySendDetailsRequest request) throws ClientException;
}

AliCloudContextAutoConfiguration

@Configuration(proxyBeanMethods = false
)
@EnableConfigurationProperties({AliCloudProperties.class})
public class AliCloudContextAutoConfiguration {public AliCloudContextAutoConfiguration() {}
}

AliCloudProperties

@ConfigurationProperties("alibaba.cloud")
public class AliCloudProperties implements AliCloudConfiguration {public static final String PROPERTY_PREFIX = "alibaba.cloud";public static final String ACCESS_KEY_PROPERTY = "alibaba.cloud.access-key";public static final String SECRET_KEY_PROPERTY = "alibaba.cloud.secret-key";private String accessKey;private String secretKey;public AliCloudProperties() {}

sms 短信服务说明相关推荐

  1. 阿里云sms短信服务

    阿里云sms短信服务 阿里云短信介绍 开通阿里云短信服务 添加签名管理与模板管理 获取用户AccessKey 搭建server-msm模块 导入Maven依赖 application.yml 启动类 ...

  2. 一小时学会使用SpringBoot整合阿里云SMS短信服务

    1. 登录阿里云进入控制台 进入阿里云控制台,https://home.console.aliyun.com/在个人头像位置点击进入AccessKey管理: 2. 创建用户和用户组 创建用户组 添加完 ...

  3. JAVA对接发送SMS短信服务

    JAVA对接发送SMS短信服务 短信服务申请 JAVA对接 代码编写 配置类 SmsComponent nacos配置中心--对应上面读取的参数 调用 Vue前端测试代码 效果 结语 短信服务申请 网 ...

  4. 解忧云SMS短信服务平台系统 短信发送系统源码 全解密随时可以二开无后门

    解忧云SMS短信服务平台系统 短信发送系统 全解密完美版 经过一系列修复现在程序已经可以完全使用. 并且是全解密随时可以二开.无后门. 一些bug已经完全修复 安装教程 数据库配置文件路径 .env ...

  5. 解忧云SMS短信服务平台系统 短信发送系统 全解密完美版

    简介: 全网首发 解忧云SMS短信服务平台系统 短信发送系统 全解密完美版 经过一系列修复现在程序已经可以完全使用. 并且是全解密随时可以二开.无后门. 一些bug已经完全修复 安装教程 数据库配置文 ...

  6. 【微服务集成阿里SMS短信服务发送短信】

    发送短信项目中很多地方都在使用,所以集成一个单独的服务,如果某个服务需要发送短信只需要依赖短信服务即可. 1.开通阿里SMS短信,创建模板 (省略) 2.创建短信服务 common-server-sm ...

  7. 阿里云SMS短信服务的使用

    短信服务是每个商家和企业都会去使用的,用户会收到106开头的号码的短信的内容,多用于用户传递验证码.系统通知等. 下面记录一下使用阿里云短信服务的经验和心得 ~ 以下忽略申请流程,直接接入短息服务.. ...

  8. 适用于AbpBoilerplate的阿里云腾讯云Sms短信服务

    Sms 适用于AbpBoilerplate的短信服务(Short Message Service,SMS)模块,通过简单配置即可使用,仅更改一处代码即可切换短信服务提供商. Aliyun.Sms由阿里 ...

  9. 对接阿里云sms短信服务发送验证码

    1.购买阿里云短信服务 2.申请签名 3.申请短信模板 4.获取密钥 5.maven依赖 <dependency><groupId>com.aliyun</groupId ...

最新文章

  1. 马云的 ATM 梦实现了
  2. dht11 python mysql,自己动手实现智能家居之温湿度数据采集存储(DHT11,MySql)
  3. json-schema 简介
  4. 关于页面加载的方法收集
  5. python3.6安装scrapy-Windows下安装scrapy(python3.6)
  6. 在线音乐电台Pandora股价暴涨20% CEO肯尼迪辞任
  7. windows找不到文件javaw_windows电脑上,怎么快速找文件?
  8. (课程学习笔记)Python基础学习
  9. 初来乍到!各位博客朋友多多支持!
  10. Bootstrap补充
  11. CSS3过渡练习-进度条(CSS3)
  12. 【定制开发】【M3】基于Python+pygame实现的人机AI对战五子棋游戏(保姆级入门讲解)
  13. HDMI 分配器正确使用方法
  14. 软件测试cmm等级划分,CMM的五个等级及关键过程域
  15. python库阿里云镜像大全
  16. 电商直播的直播类型有哪些?
  17. Vue面试题你学会多少
  18. Windows6.1-KB2661332-x64 远程桌面服务当前正忙,因此无法完成您尝试执行的任务
  19. Windows下的很多程序都有十分漂亮的菜单
  20. Mysql翻页查询数据重复怎么办?

热门文章

  1. 递归实现 1,1,2,3,5,8,….第 30 个数是多少?
  2. 机器学习作业之波士顿房价(boston)数据分析与绘图(注释我都写了这么多,我不信你还看不懂?)
  3. matlab绕线式三级串阻,三相绕线式异步电动机转子串电阻起动的MATLAB仿真
  4. SSH连接服务器断开
  5. 弹性云主机利用云镜像克隆新开、迁移数据[云镜像]
  6. BAT等互联网公司薪资分享
  7. EMLOG模板 自适应Fontopen3 可做企业站
  8. Sqoop 使用详解
  9. 在线英文广播电视资源
  10. Pyton 类和对象