Package com.storedobject.mail
Class Server
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intBatch size - How many messages to be read for sending in one batch?protected StringAdditional condition to be be added when messages are read for sending.protected intsendMessage(Mail message) Send a message.protected booleansendMessages(List<Mail> messages) Send a batch of messages.Methods inherited from class com.storedobject.job.MessageSender
canSend, execute, getCreditBalance, getDeliveryCost, initialize, kick, monitorDeliveryCost, recover, shutdown, terminate
-
Constructor Details
-
Server
-
-
Method Details
-
sendMessage
Description copied from class:MessageSenderSend a message. The method should just send the message and should not update any status.- Specified by:
sendMessagein classMessageSender<Mail>- Parameters:
message- Message to send.- Returns:
- The error code to indicate the status. 0: Successful, 1: Retry later, 2: Insufficient balance. Anything
above 2 indicates an error condition that doesn't allow this message to be sent (for example, invalid mobile
number in case of an
SMSMessage).
-
getBatchSize
protected int getBatchSize()Description copied from class:MessageSenderBatch size - How many messages to be read for sending in one batch?- Overrides:
getBatchSizein classMessageSender<Mail>- Returns:
- Default is 50.
-
sendMessages
Description copied from class:MessageSenderSend a batch of messages. The default implementation of this method processes each message by invokingMessageSender.sendMessage(Message)and if this is overridden, theMessageSender.sendMessage(Message)will not be invoked from elsewhere.Note: The Status of the message should be updated adn saved within this method if overridden.
- Overrides:
sendMessagesin classMessageSender<Mail>- Parameters:
messages- Messages to be sent.- Returns:
- True if messages are sent successfully.
-
getSelectCondition
Description copied from class:MessageSenderAdditional condition to be be added when messages are read for sending.- Overrides:
getSelectConditionin classMessageSender<Mail>- Returns:
- Default implementation returns null, so no additional selection criteria are applied.
-