Class HuaweiSmsSender
java.lang.Object
cloud.opencode.base.sms.provider.HuaweiSmsSender
- All Implemented Interfaces:
SmsProvider
Huawei Cloud SMS Sender
华为云短信发送器
SMS sender implementation for Huawei Cloud using WSSE authentication. Supports batch SMS sending via Huawei Cloud SMS API.
使用WSSE认证的华为云短信发送器实现。 支持通过华为云短信API批量发送短信。
Features | 主要功能:
- WSSE authentication - WSSE认证
- Single and batch SMS sending - 单条和批量短信发送
- Template-based messaging - 基于模板的消息
- Virtual thread HTTP client - 虚拟线程HTTP客户端
Usage Example | 使用示例
var config = new HuaweiSmsConfig(
"your-app-key",
"your-app-secret",
"sender-channel",
"channel-id",
"cn-north-4"
);
var sender = HuaweiSmsSender.create(config);
var result = sender.send(SmsMessage.of("+8613800138000", "Your code is 123456"));
Security | 安全性:
- Thread-safe: Yes (immutable config, shared HttpClient) - 线程安全: 是(不可变配置,共享HttpClient)
- Since:
- JDK 25, opencode-base-sms V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordHuawei SMS Configuration 华为短信配置 -
Method Summary
Modifier and TypeMethodDescriptionstatic HuaweiSmsSenderCreate Huawei SMS sender with config 使用配置创建华为短信发送器Get the configuration 获取配置Get the endpoint URL 获取端点URLgetName()Get provider name 获取提供商名称booleanCheck if provider is available 检查提供商是否可用send(SmsMessage message) Send single SMS 发送单条短信sendBatch(List<SmsMessage> messages) Send batch SMS 批量发送短信Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SmsProvider
close
-
Method Details
-
create
Create Huawei SMS sender with config 使用配置创建华为短信发送器- Parameters:
config- the configuration | 配置- Returns:
- the sender instance | 发送器实例
-
send
Description copied from interface:SmsProviderSend single SMS 发送单条短信- Specified by:
sendin interfaceSmsProvider- Parameters:
message- the message | 消息- Returns:
- the result | 结果
-
sendBatch
Description copied from interface:SmsProviderSend batch SMS 批量发送短信- Specified by:
sendBatchin interfaceSmsProvider- Parameters:
messages- the messages | 消息列表- Returns:
- the results | 结果列表
-
getName
Description copied from interface:SmsProviderGet provider name 获取提供商名称- Specified by:
getNamein interfaceSmsProvider- Returns:
- the name | 名称
-
isAvailable
public boolean isAvailable()Description copied from interface:SmsProviderCheck if provider is available 检查提供商是否可用- Specified by:
isAvailablein interfaceSmsProvider- Returns:
- true if available | 如果可用返回true
-
getConfig
Get the configuration 获取配置- Returns:
- the config | 配置
-
getEndpoint
-