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. 019_Jedis的List数据类型
  2. 服务器手工修改虚拟内存,服务器修改虚拟内存
  3. vue全局使用electron
  4. spock测试_使用Spock测试您的代码
  5. python各种语言间时间的转化
  6. 小白零基础怎么学习Java?不要慌
  7. 《ArcGIS Runtime SDK for .NET开发笔记》--三维功能
  8. 如何在 vue 项目中引入 html 文件
  9. C++并发与多线程(三)单例设计模式与共享数据分析、call_once、condition_variable使用
  10. 每次连接服务器都要source ~/.bashrc问题
  11. 用Python写一个Excel汇总和比对小程序
  12. 自动计数报警器c语言程序,自动计数报警器.ppt
  13. PDF文件怎么编辑内容
  14. python语言由psf组织所有、这是一个商业组织_智慧职教云课堂APP店长实务答案搜题公众号...
  15. 安卓中的inflate方法
  16. 使用 Swift 语言编程的优缺点
  17. lisp pl线线段数_编写lisp程序多条多段线连接成一条多段线
  18. Erlang公历转农历
  19. [程序人生]--人生架构三个层次:智慧是大脑,选择是躯干,知识文化是血肉
  20. 荣耀30s怎么升级鸿蒙,惊喜!4部荣耀手机可升级至华为鸿蒙系统,网友表示:终于等到了...

热门文章

  1. php爆路径方法收集
  2. BZOJ 4199 [Noi2015]品酒大会(后缀自动机 + parent树上统计)
  3. pdf 改变页面大小 python_用Python开发PDF编辑器,实现PDF页面提取,页面合并与替换...
  4. java caller_【JavaScript】callee 与 caller
  5. GoogleTest系列:TEST_P的基本用法
  6. 拼多多优惠券赔付规则 拼多多发货超时具体怎么赔 拼多多超时发货之后没有优惠券怎么办
  7. 服务器系统迁移方案,服务器与应用系统迁移方案.doc
  8. Ext2.2 combo 多选效果
  9. (转)通过修改键盘映射替代损坏按键
  10. 计算机视觉笔记及资料整理(含图像分割、目标检测小方向学习)