com.ibm.commerce.messaging.outboundservice

Class SendTransactedMsgCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, SendTransactedMsgCmd, Protectable, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class SendTransactedMsgCmdImpl
    extends ControllerCommandImpl
    implements SendTransactedMsgCmd
    Goes through the current contents of the MSGSTORE table and sends all the available messages with retries greater than 0. Messages in this table can span multiple records. If the message is sent, it will be removed from the table. If the message is not sent, the retries field will be decremented. No view is called after this command is executed because it is intended to be used by the scheduler.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SendTransactedMsgCmdImpl

        public SendTransactedMsgCmdImpl()
        Constructs the SendTransactedMsg object by calling its parents constructor.
    • Method Detail

      • afterFail

        public void afterFail(java.lang.Long msg_id,
                              java.lang.Integer tran_id,
                              java.lang.Integer retries,
                              java.sql.Timestamp expiry)
        This method updates the message in the MSGSTORE table by decrementing the retries field by one. This ensures that the message had a fair chance before refusing to send the message.
        Parameters:
        msg_id - The message identifier
        tran_id - The transport identifier
        retries - The number of retries
        expiry - The timestamp expiry value
      • afterSuccess

        public void afterSuccess(java.lang.Long msg_id,
                                 java.lang.Integer tran_id)
        After the message is successfully sent, it will be removed from the MSGSTORE table.
        Parameters:
        msg_id - The message identifier
        tran_id - The transport identifier
      • afterSuccessKeepMessage

        public void afterSuccessKeepMessage(java.lang.Long msg_id,
                                            java.lang.Integer tran_id)
        This method stores the content of each message into the MSGARCHIVE table
        Parameters:
        msg_id - The message identifier
        tran_id - The transport identifier
      • assembleMsg

        public void assembleMsg()
        This method takes all messages from MsgStoreAccessBean with retries greater than 0 and attempts to send the messages.
      • getResourceOwners

        public java.lang.Long[] getResourceOwners()
                                           throws ECException
        This method returns the Organization unit reference numbers for all the resources accessed by this command. It will return null if no resource is being accessed by this command.
        Specified by:
        getResourceOwners in interface AccCommand
        Overrides:
        getResourceOwners in class ControllerCommandImpl
        Returns:
        Long[] - an array of all organization unit reference numbers
        Throws:
        ECException
      • afterFailCheckExpired

        public void afterFailCheckExpired(java.lang.Long msg_id,
                                          java.lang.Integer tran_id,
                                          java.lang.Integer retries,
                                          java.lang.String duration)
        Checks whether the expiry field within the MSGSTORE table has expired. If the expiry field is empty, the expiry time is calculated and the field is updated. Calls afterFail() after performing the above check.
        Parameters:
        msg_id - The message identifier
        tran_id - The transport identifier
        retries - The number of retries
        duration - The expiry value
      • listMessages

        public java.util.LinkedList listMessages(java.lang.Integer retriesGreaterThan)
                                          throws java.lang.Exception
        Gets the next available message ID to send.
        Parameters:
        retriesGreaterThan - the retries value used to search for the list of queued messages.
        Returns:
        the list of queued messages to send.
        Throws:
        java.lang.Exception
      • findNextMsgIdIndex

        public int findNextMsgIdIndex(java.util.LinkedList messageList)
        Finds the index of the next message ID to send when the previous message cannot be found. The previous message might have been removed from the database after the message list is determined by this SendTransactedMsg job instance. The next message id returned is determined to have less chance of being removed by another SendTransactedMsg job.
        Parameters:
        messageList - the list of queued message IDs.
        Returns:
        The ID of the next queued message.
        • -1 if the message list is null
        • 0 if the size of the message list is 0 or 1