Class SmsOutbox
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.sms.SmsOutbox
- All Implemented Interfaces:
SmsInbox
Bounded, thread-safe, in-memory record of the messages the
LoggingSmsSender "sent", so the development
inbox can show them, which reads it through the domain port SmsInbox. The oldest message is evicted when the
capacity is reached.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
messages
Messages, oldest first. -
capacity
private final int capacityMaximum number of messages kept.
-
-
Constructor Details
-
SmsOutbox
public SmsOutbox(int capacity) Creates the outbox.- Parameters:
capacity- maximum number of messages kept.- Throws:
IllegalArgumentException- if the capacity is not positive.
-
-
Method Details
-
add
Records a message, evicting the oldest ones beyond the capacity.- Parameters:
message- the message.
-
messages
Reads the recorded messages.- Returns:
- an immutable snapshot, oldest first.
-
entries
Lists the recorded messages as the inbox port describes them.
-