Class TransactionProcessor

All Implemented Interfaces:
IServiceDefinitionAware, ITransactionProcessor

public class TransactionProcessor extends CayenneService implements ITransactionProcessor, IServiceDefinitionAware
Provides the default service of type "Transaction Processor". This implementation performs task expiry, submission abandonment, receipting and delivery in this order. For each step, the set of eligible submissions is calculated separately. Submissions may take part in multiple steps, e.g. receipting and then delivery. Each step can be turned off using service parameters, but this means submissions will not be processed, creating a backlog. Therefore, turning off a step should be used only for a short time when needed.
Since:
4.1.0
  • Constructor Details

    • TransactionProcessor

      public TransactionProcessor()
  • Method Details

    • processTransactions

      public void processTransactions()
      Process the list of transactions in the system, performing necessary steps such as abandonment, receipting and delivery in a meaningful sequence. Each step will operate only on the set of transactions eligible for it and commit its work before the next step starts.
      Specified by:
      processTransactions in interface ITransactionProcessor
      See Also:
    • interruptProcessing

      public void interruptProcessing()
      Interrupt ongoing transaction processing. This does not happen instantaneously, but the service will check at suitable occasions (e.g. after processing a submission) and stop processing.
      Specified by:
      interruptProcessing in interface ITransactionProcessor
      See Also:
    • isIncludeTaskExpiry

      @Deprecated public boolean isIncludeTaskExpiry()
      Deprecated.
      Obsolete in TM 18.5.0.
      Specified by:
      isIncludeTaskExpiry in interface ITransactionProcessor
      Returns:
      the value of the includeTaskExpiry service parameter
      See Also:
    • setIncludeTaskExpiry

      @Deprecated public void setIncludeTaskExpiry(boolean includeTaskExpiry)
      Deprecated.
      Obsolete in TM 18.5.0. Note: Turning off a processing step will cause a backlog. Use with caution and re-enable the step as soon as possible.
      Parameters:
      includeTaskExpiry - the new value of the includeTaskExpiry service parameter
    • isIncludeAbandonment

      public boolean isIncludeAbandonment()
      Returns whether the transaction processor will perform submission abandonment.
      Specified by:
      isIncludeAbandonment in interface ITransactionProcessor
      Returns:
      the value of the includeAbandonment service parameter
      See Also:
    • setIncludeAbandonment

      public void setIncludeAbandonment(boolean includeAbandonment)
      Set whether the transaction processor will perform submission abandonment. Note: Turning off a processing step will cause a backlog. Use with caution and re-enable the step as soon as possible.
      Parameters:
      includeAbandonment - the new value of the includeAbandonment service parameter
    • isIncludeDelivery

      public boolean isIncludeDelivery()
      Returns whether the transaction processor will perform submission delivery.
      Specified by:
      isIncludeDelivery in interface ITransactionProcessor
      Returns:
      the value of the includeDelivery service parameter
      See Also:
    • setIncludeDelivery

      public void setIncludeDelivery(boolean includeDelivery)
      Set whether the transaction processor will perform delivery. Note: Turning off a processing step will cause a backlog. Use with caution and re-enable the step as soon as possible.
      Parameters:
      includeDelivery - the new value of the includeDelivery service parameter
    • isIncludeRESTDeliveryRetry

      public boolean isIncludeRESTDeliveryRetry()
      Specified by:
      isIncludeRESTDeliveryRetry in interface ITransactionProcessor
      Returns:
      whether the transaction processor will perform REST delivery retry.
      Since:
      4.1.8
    • setIncludeRESTDeliveryRetry

      public void setIncludeRESTDeliveryRetry(boolean includeRESTDeliveryRetry)
      Set whether the transaction processor will perform REST delivery retry. Note: Turning off a processing step will cause a backlog. Use with caution and re-enable the step as soon as possible.
      Parameters:
      includeRESTDeliveryRetry - the new value of the includeDelivery service parameter
      Since:
      4.1.8
    • isIncludeTransactionHistory

      public boolean isIncludeTransactionHistory()
      Returns whether the transaction processor will create transaction history records
      Specified by:
      isIncludeTransactionHistory in interface ITransactionProcessor
      Returns:
      whether the transaction processor will create transaction history records
      Since:
      5.1.0
      See Also:
    • setIncludeTransactionHistory

      public void setIncludeTransactionHistory(boolean transactionHistory)
      Set whether the transaction processor will will create transaction history records
      Parameters:
      transactionHistory - the new value of the transactionHistory service parameter
      Since:
      5.1.0
    • isIncludeDataRetention

      public boolean isIncludeDataRetention()
      Returns whether the transaction processor will perform data retention
      Specified by:
      isIncludeDataRetention in interface ITransactionProcessor
      Returns:
      whether the transaction processor will perform data retention.
      Since:
      4.3.3
      See Also:
    • setIncludeDataRetention

      public void setIncludeDataRetention(boolean includeDataRetention)
      Set whether the transaction processor will perform data retention.
      Parameters:
      includeDataRetention - the new value of the includeDataRetention service parameter
      Since:
      4.3.3
    • getFetchLimitForAbandonment

      public int getFetchLimitForAbandonment()
      Returns the fetch limit to use for submission abandonment. Note: Abandonment works on four different classes of submission. Each of them uses the fetch limit, so in theory the abandonment step may process up to 4xfetchLimitForAbandonment records
      Returns:
      the value of the fetchLimitForAbandonment service parameter
    • setFetchLimitForAbandonment

      public void setFetchLimitForAbandonment(int fetchLimitForAbandonment)
      Set the fetch limit to use for submission abandonment. Note: Abandonment works on four different classes of submission. Each of them uses the fetch limit, so in theory the abandonment step may process up to 4xfetchLimitForAbandonment records
      Parameters:
      fetchLimitForAbandonment - the new value of the fetchLimitForAbandonment service parameter
    • getFetchLimitForDelivery

      public int getFetchLimitForDelivery()
      Returns the fetch limit to use for submission delivery.
      Returns:
      the value of the fetchLimitForDelivery service parameter
    • setFetchLimitForDelivery

      public void setFetchLimitForDelivery(int fetchLimitForDelivery)
      Set the fetch limit to use for submission delivery.
      Parameters:
      fetchLimitForDelivery - the new value of the fetchLimitForDelivery service parameter
    • getFetchLimitForHistory

      public int getFetchLimitForHistory()
      Returns the fetch limit to use for transaction history creation
      Returns:
      the value of the fetchLimitForHistory service parameter
    • setFetchLimitForHistory

      public void setFetchLimitForHistory(int fetchLimitForHistory)
      Set the fetch limit to use for transaction history creation
      Parameters:
      fetchLimitForHistory - the new value of the fetchLimitForHistory service parameter
    • getFetchLimitForTransactionPurging

      public int getFetchLimitForTransactionPurging()
      The maximum number of records to process for Transaction record purging
      Returns:
      the maximum number of records to process for Transaction record purging
      Since:
      4.3.3
    • setFetchLimitForTransactionPurging

      public void setFetchLimitForTransactionPurging(int limit)
      The maximum number of records to process for Transaction record purging
      Parameters:
      limit - the maximum number of records to process for Transaction record purging
      Since:
      4.3.3
    • setLogToEventLog

      public void setLogToEventLog(boolean value)
      Specify whether to log the results of the transaction processing to the event log.
      Specified by:
      setLogToEventLog in interface ITransactionProcessor
      Parameters:
      value - to specify whether to log the results of the transaction processing to the event log
      Since:
      4.3.3
    • getSystemAlertTimeMinutes

      public int getSystemAlertTimeMinutes()
      Returns the number of minutes that the system monitoring job will use when determining whether system alerts need to be raised about the transaction processing service. For example, if the transaction processing job has not run in the last n minutes (as determined by this setting) and is not paused, a system alert will be raised.
      Specified by:
      getSystemAlertTimeMinutes in interface ITransactionProcessor
      Returns:
      the number of minutes to use in system monitoring
      See Also:
    • setSystemAlertTimeMinutes

      public void setSystemAlertTimeMinutes(int systemAlertTimeMinutes)
      Set the number of minutes that the system monitoring job will use when determining whether system alerts need to be raised about the transaction processing service. For example, if the transaction processing job has not run in the last n minutes (as determined by this setting) and is not paused, a system alert will be raised.
      Parameters:
      systemAlertTimeMinutes - the new value of the systemAlertTimeMinutes service parameter
    • getMaxDataRetentionPeriod

      public int getMaxDataRetentionPeriod()
      Returns:
      the maximum data retention period in seconds to perform.
      Since:
      18.11.0
    • setMaxDataRetentionPeriod

      public void setMaxDataRetentionPeriod(int maxDataRetentionPeriod)
      Set the maximum data retention period in seconds to perform.
      Parameters:
      maxDataRetentionPeriod - the maximum data retention period in seconds
      Since:
      18.11.0
    • getServiceDefinition

      public ServiceDefinition getServiceDefinition()
      Return the service definition for this service.
      Specified by:
      getServiceDefinition in interface IServiceDefinitionAware
      Returns:
      the service definition
      See Also:
    • setServiceDefinition

      public void setServiceDefinition(ServiceDefinition serviceDefinition)
      Set the service definition for this service.
      Specified by:
      setServiceDefinition in interface IServiceDefinitionAware
      Parameters:
      serviceDefinition - the new service definition
      See Also: