Class SmsFailoverNotifier
java.lang.Object
com.chatmotorapi.api.notify.failover.SmsFailoverNotifier
- All Implemented Interfaces:
FailoverNotifier
public class SmsFailoverNotifier extends Object implements FailoverNotifier
SmsFailoverNotifier sends an SMS to a list of phone numbers using Twilio
when a failover event occurs. It is primarily designed for integration into
systems that require robust notification mechanisms to handle critical operational
changes such as API key failovers.
This class leverages the Twilio API for sending messages and requires valid Twilio credentials. It is intended for use as part of applications that need to respond dynamically to operational disruptions.
Usage Example:
SmsFailoverNotifier notifier = SmsFailoverNotifier.builder()
.logger(logger)
.accountSid("Your_Twilio_Account_SID")
.authToken("Your_Twilio_Auth_Token")
.phoneNumbers(Arrays.asList("+15556667777"))
.messageText("Failover event detected: switching to backup services.")
.fromPhoneNumber("+15558889999")
.build();
notifier.notifyFailover();
- See Also:
Message
,Twilio
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SmsFailoverNotifier.Builder
Builder class for SmsFailoverNotifier. -
Method Summary
Modifier and Type Method Description static SmsFailoverNotifier.Builder
builder()
Initiates the builder for SmsFailoverNotifier.void
notifyFailover()
Sends an SMS notification to all phone numbers in the list informing them of a failover event.
-
Method Details
-
notifyFailover
public void notifyFailover()Sends an SMS notification to all phone numbers in the list informing them of a failover event. It initializes Twilio with the provided account SID and auth token, and sends the message from a specified phone number.- Specified by:
notifyFailover
in interfaceFailoverNotifier
-
builder
Initiates the builder for SmsFailoverNotifier.- Returns:
- a new instance of Builder for configuring SmsFailoverNotifier.
-