Class FilesystemRetryStore

  • All Implemented Interfaces:
    ComponentLifecycle, ComponentLifecycleExtension, RetryStore

    @ComponentProfile(summary="Store message for retry on the filesystem.",
                      since="3.11.1")
    public class FilesystemRetryStore
    extends java.lang.Object
    implements RetryStore
    Writes data into local storage for retry.

    While not tightly coupled with RetryFromJetty it is designed somewhat exclusively for that. You may be able to make use of it in other ways, but behaviour may change unexpectedly due to changes in RetryFromJetty.

    The behaviour of this store will assume that each message-id will form a sub-directory off baseUrl. Metadata will be stored [baseUrl]/[msgId]/metadata.properties as a standard properties file; the payload will be stored in [baseUrl]/[msgId]/payload.blob.

    Since:
    3.11.1

    In the adapter configuration file this class is aliased as retry-store-filesystem which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • FilesystemRetryStore

        public FilesystemRetryStore()
    • Method Detail

      • getMetadata

        public java.util.Map<java.lang.String,​java.lang.String> getMetadata​(java.lang.String msgId)
                                                                           throws InterlokException
        Description copied from interface: RetryStore
        Retrieve the metadata associated with the msgId the store.

        This is used to assert that the workflow exists in this instance for that message; there is no point building the whole message only to fail because the workflow doesn't exist.

        Specified by:
        getMetadata in interface RetryStore
        Throws:
        InterlokException - if no metadata could be retrieved (e.g the msgId doesn't exist)
      • createForReport

        protected static RemoteBlob createForReport​(java.io.File baseDir)
      • acknowledge

        public void acknowledge​(java.lang.String acknowledgeId)
                         throws InterlokException
        Description copied from interface: RetryStore

        Acknowledge that the message with the passed ID has now been successfully processed and should not be retried again. NB this method does not throw an Exception if the acknowledge ID does not exist in the store.

        Specified by:
        acknowledge in interface RetryStore
        Parameters:
        acknowledgeId - the acknowledge ID of the message to acknowledge
        Throws:
        InterlokException - wrapping any Exception which occurs
      • obtainExpiredMessages

        public java.util.List<AdaptrisMessage> obtainExpiredMessages()
                                                              throws InterlokException
        Description copied from interface: RetryStore

        Obtain a list of AdaptrisMessages which meet the expiration criteria. In the most abstract sense, expired messages are those that have exceeded their max retry count but not yet been acknowledged.

        Specified by:
        obtainExpiredMessages in interface RetryStore
        Returns:
        a list of AdaptrisMessages which meet the expiration criteria.
        Throws:
        InterlokException - wrapping any Exception which occurs
      • updateRetryCount

        public void updateRetryCount​(java.lang.String messageId)
                              throws InterlokException
        Description copied from interface: RetryStore

        Update the number of retries which have taken place for the message with the passed ID. NB this method does not throw an Exception if an attempt is made to update the retry count for a message ID which does not exist in the store.

        Specified by:
        updateRetryCount in interface RetryStore
        Parameters:
        messageId - the ID of the message to update
        Throws:
        InterlokException - wrapping any Exception which occurs
      • getBaseUrl

        public java.lang.String getBaseUrl()
        The base URL file:///... where we can discover files.
      • setBaseUrl

        public void setBaseUrl​(java.lang.String baseUrl)
        The base URL file:///... where we can discover files.