com.ibm.commerce.messaging.outboundservice
Class SendTransactedMsgCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.messaging.outboundservice.SendTransactedMsgCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, SendTransactedMsgCmd

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 messages is not sent, the retries field will be decremented. No view is call after this command is executed because it is intended to be used by the scheduler.


Field Summary
static java.lang.String COPYRIGHT
           
 
Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.messaging.outboundservice.SendTransactedMsgCmd
defaultCommandClassName, NAME
 
Constructor Summary
SendTransactedMsgCmdImpl()
          Constructs the SendTransactedMsg object.
 
Method Summary
 void afterFail(java.lang.Long msg_id, java.lang.Integer retries)
          Updates the message in the MSGSTORE table by decrementing retries field by one to ensure that the message had a fair chance before refusing to send the message.
 void afterSuccess(java.lang.Long msg_id)
          After the message is successfully sent, it will be removed from the MSGSTORE table.
 void assembleMsg()
          Picks up all the messages from the MsgStoreAccessBean with retries greater then 0 and attempts to send the message.
 java.lang.Long[] getResourceOwners()
          This method returns the Organization unit reference numbers for all the resources accessed by this command It will return null if no resource if being accessed by this command.
 void performExecute()
          Assembles the messages in the MsgStoreAccessBean and sends the messages.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setRequestProperties, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

SendTransactedMsgCmdImpl

public SendTransactedMsgCmdImpl()
Constructs the SendTransactedMsg object.
Method Detail

afterFail

public void afterFail(java.lang.Long msg_id,
                      java.lang.Integer retries)
Updates the message in the MSGSTORE table by decrementing retries field by one to ensure that the message had a fair chance before refusing to send the message.
Parameters:
msg_id - java.lang.Long
retries - java.lang.Integer

afterSuccess

public void afterSuccess(java.lang.Long msg_id)
After the message is successfully sent, it will be removed from the MSGSTORE table.
Parameters:
msg_id - Long

assembleMsg

public void assembleMsg()
Picks up all the messages from the MsgStoreAccessBean with retries greater then 0 and attempts to send the message. Then updates the messages status depending on the result when attempting to send the message.

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 if 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

performExecute

public void performExecute()
                    throws ECException
Assembles the messages in the MsgStoreAccessBean and sends the messages.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.