diff --git a/README.md b/README.md index 9766d93e..f74a27f4 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,10 @@ -

+

## 前言 + 在日常的开发过程中,短信的发送经常使用(尤其是中小型的外包公司),毕竟不是每个公司都有阿里腾讯一样的实力, 也不是每个都像银行联通等公司一样有内部的短信规程。第三方的短信往往是最常见的解决方案,但是市面上第三方短信服务商众多, 各家都有不同的方式和标准,每次需要使用时候,都需要花费时间去阅读文档和编写相应的工具,为一个短信浪费了太多的精力和时间。 @@ -19,36 +20,42 @@ #### [在线文档](https://apidoc.gitee.com/the-wind-is-like-a-song/sms_aggregation) ## 支持厂商一览 + 目前刚刚发布第一版本,支持尚少,后续会集成更多的厂商 + - **阿里云国内短信** - **腾讯云国内短信** - **合一短信** - **云片短信** ## 在SpringBoot环境集成 + 1. maven引入 -```xml - + + ```xml + kim.wind sms-aggregation-spring-boot-starter version - -``` + + ``` 2. 设置配置文件 -```yaml -sms: - # 短信服务商 - supplier: alibaba - # 是否开启短信发送限制 默认false - restricted: true - # 以下设置仅在开启短信发送限制后生效 - # 是否使用redis进行缓存 默认false - redisCache: true - # 单账号每日最大发送量 - accountMax: 20 - # 单账号每分钟最大发送 - minuteMax: 2 - + + ```yaml + sms: + # 短信服务商 + supplier: alibaba + # 是否开启短信发送限制 默认false + restricted: true + # 以下设置仅在开启短信发送限制后生效 + # 是否使用redis进行缓存 默认false + redisCache: true + # 单账号每日最大发送量 + accountMax: 20 + # 单账号每分钟最大发送 + minuteMax: 2 + ``` + ``` 阿里云配置示意 ```yaml @@ -69,25 +76,53 @@ sms: #请求地址 默认为dysmsapi.aliyuncs.com 如无特殊改变可以不用设置 requestUrl: dysmsapi.aliyuncs.com ``` + 3. 方法使用 -```java -public class Demo{ + + ```java + public class Demo{ //此处作为演示使用,推荐使用构造注入或set注入 @Autowired private final SmsBlend sms; - + public void test() { //发送固定模板短信 SmsResponse smsResponse = sms.sendMessage("18888888888","测试固定模板短信"); System.out.println(smsResponse); } - -} + } + ``` + + +## 配置详解 + +#### 线程池配置 + +每一家厂商都对于异步短信有不同的支持,有些甚至没有,为了统一存在一个异步短信,我们配置了一个线程池用于执行异步短信任务,线程池默认配置如下: + +```yaml +sms: + #核心线程池大小 + corePoolSize: 10 + #最大线程数 + maxPoolSize: 30 + #队列容量 + queueCapacity: 50 + #活跃时间 + keepAliveSeconds: 60 + # 线程名字前缀 + threadNamePrefix: sms-executor- + #设置线程池关闭的时候等待所有任务都完成再继续销毁其他的Bean + shutdownStrategy: true ``` +以上线程池为默认的配置,如果有需要可以跟随自己的需求在yml文件进行配置 + +``` ## 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request +``` diff --git a/pom.xml b/pom.xml index d136db3b..432ff364 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 kim.wind sms_aggregation - 1.0.0 + 1.0.1 sms-aggregation pom sms_aggregation @@ -48,7 +48,7 @@ 1.8 2.7.10 - 1.0.0 + 1.0.1 2.0.23 2.0.15 3.14.9 diff --git a/sms-aggregation-aliyun/pom.xml b/sms-aggregation-aliyun/pom.xml index 61b1ff9c..b5048353 100644 --- a/sms-aggregation-aliyun/pom.xml +++ b/sms-aggregation-aliyun/pom.xml @@ -5,13 +5,13 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-aliyun sms-aggregation-aliyun sms-aggregation-aliyun - 1.0.0 + 1.0.1 1.8 diff --git a/sms-aggregation-api/pom.xml b/sms-aggregation-api/pom.xml index 0e3dd65b..d60f3bac 100644 --- a/sms-aggregation-api/pom.xml +++ b/sms-aggregation-api/pom.xml @@ -5,13 +5,13 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-api sms-aggregation-api sms-aggregation-api - 1.0.0 + 1.0.1 1.8 diff --git a/sms-aggregation-comm/pom.xml b/sms-aggregation-comm/pom.xml index 2bd2a8e5..563955f1 100644 --- a/sms-aggregation-comm/pom.xml +++ b/sms-aggregation-comm/pom.xml @@ -5,13 +5,13 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-comm sms-aggregation-comm sms-aggregation-comm - 1.0.0 + 1.0.1 1.8 diff --git a/sms-aggregation-spring-boot-starter/pom.xml b/sms-aggregation-spring-boot-starter/pom.xml index 4335db06..be76d745 100644 --- a/sms-aggregation-spring-boot-starter/pom.xml +++ b/sms-aggregation-spring-boot-starter/pom.xml @@ -5,13 +5,13 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-spring-boot-starter sms-aggregation-spring-boot-starter sms-aggregation-spring-boot-starter - 1.0.0 + 1.0.1 jar diff --git a/sms-aggregation-tencent/pom.xml b/sms-aggregation-tencent/pom.xml index 30544b60..5c17d7f8 100644 --- a/sms-aggregation-tencent/pom.xml +++ b/sms-aggregation-tencent/pom.xml @@ -5,13 +5,13 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-tencent sms-aggregation-tencent sms-aggregation-tencent - 1.0.0 + 1.0.1 1.8 diff --git a/sms-aggregation-unisms/pom.xml b/sms-aggregation-unisms/pom.xml index cb23236e..ab28233d 100644 --- a/sms-aggregation-unisms/pom.xml +++ b/sms-aggregation-unisms/pom.xml @@ -5,13 +5,13 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-unisms sms-aggregation-unisms sms-aggregation-unisms - 1.0.0 + 1.0.1 1.8 diff --git a/sms-aggregation-yunpian/pom.xml b/sms-aggregation-yunpian/pom.xml index d46ae66c..99ae2c04 100644 --- a/sms-aggregation-yunpian/pom.xml +++ b/sms-aggregation-yunpian/pom.xml @@ -5,14 +5,14 @@ kim.wind sms_aggregation - 1.0.0 + 1.0.1 ../pom.xml sms-aggregation-yunpian sms-aggregation-yunpian sms-aggregation-yunpian - 1.0.0 + 1.0.1 1.8