获取实例的常用方法(getByLoad和getByConfigId)更名为 getSmsBlend 方便使用

This commit is contained in:
wind 2023-08-01 18:32:44 +08:00
parent d383ec6645
commit 9b03996af6
2 changed files with 12 additions and 12 deletions

View File

@ -86,16 +86,6 @@ public abstract class SmsFactory {
return (SmsBlend) Proxy.newProxyInstance(sms.getClass().getClassLoader(), new Class[]{SmsBlend.class}, smsInvocationHandler);
}
/**
* 通过configId获取短信服务对象
*
* @param configId 唯一标识
* @return 返回短信服务对象如果未找到则返回null
*/
public static SmsBlend getByConfigId(String configId) {
return blends.get(configId);
}
/**
* 通过供应商标识获取首个短信服务对象
*
@ -129,10 +119,20 @@ public abstract class SmsFactory {
*
* @return 返回短信服务列表
*/
public static SmsBlend getByLoad() {
public static SmsBlend getSmsBlend() {
return SmsLoad.getBeanLoad().getLoadServer();
}
/**
* 通过configId获取短信服务对象
*
* @param configId 唯一标识
* @return 返回短信服务对象如果未找到则返回null
*/
public static SmsBlend getSmsBlend(String configId) {
return blends.get(configId);
}
/**
* 获取全部短信服务对象
*

View File

@ -39,7 +39,7 @@ class Sms4jTest {
return;
}
// 通过负载均衡服务获取短信服务对象
SmsResponse smsResponse = SmsFactory.getByLoad().sendMessage(PHONE, SmsUtil.getRandomInt(6));
SmsResponse smsResponse = SmsFactory.getSmsBlend().sendMessage(PHONE, SmsUtil.getRandomInt(6));
Assert.isTrue(smsResponse.isSuccess());
}