Class FilesystemRetryStore
- java.lang.Object
-
- com.adaptris.core.http.jetty.retry.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 inRetryFromJetty
.The behaviour of this store will assume that each
message-id
will form a sub-directory offbaseUrl
. 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 Summary
Constructors Constructor Description FilesystemRetryStore()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AdaptrisMessage
buildForRetry(java.lang.String msgId, java.util.Map<java.lang.String,java.lang.String> metadata, AdaptrisMessageFactory msgFac)
Build the message for retrying from the store.protected static RemoteBlob
createForReport(java.io.File baseDir)
boolean
delete(java.lang.String msgId)
Delete a message from the store (optional operation).java.lang.String
getBaseUrl()
The base URLfile:///...
where we can discover files.java.util.Map<java.lang.String,java.lang.String>
getMetadata(java.lang.String msgId)
Retrieve the metadata associated with the msgId the store.void
prepare()
Prepare for initialisation.java.lang.Iterable<RemoteBlob>
report()
Report on a list of blobs that is present in the store (optional operation).void
setBaseUrl(java.lang.String baseUrl)
The base URLfile:///...
where we can discover files.FilesystemRetryStore
withBaseUrl(java.lang.String s)
void
write(AdaptrisMessage msg)
Write a message to the store.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stop
-
Methods inherited from interface com.adaptris.core.http.jetty.retry.RetryStore
buildForRetry, buildForRetry
-
-
-
-
Method Detail
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Specified by:
prepare
in interfaceRetryStore
- Throws:
CoreException
-
write
public void write(AdaptrisMessage msg) throws InterlokException
Description copied from interface:RetryStore
Write a message to the store.- Specified by:
write
in interfaceRetryStore
- Throws:
InterlokException
-
buildForRetry
public AdaptrisMessage buildForRetry(java.lang.String msgId, java.util.Map<java.lang.String,java.lang.String> metadata, AdaptrisMessageFactory msgFac) throws InterlokException
Description copied from interface:RetryStore
Build the message for retrying from the store.- Specified by:
buildForRetry
in interfaceRetryStore
- Parameters:
msgId
- the message id.metadata
- the metadata you want to apply to the messagemsgFac
- the message factory to use- Returns:
- a message.
- Throws:
CoreException
InterlokException
-
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 interfaceRetryStore
- Throws:
InterlokException
- if no metadata could be retrieved (e.g the msgId doesn't exist)
-
report
public java.lang.Iterable<RemoteBlob> report() throws InterlokException
Description copied from interface:RetryStore
Report on a list of blobs that is present in the store (optional operation).- Specified by:
report
in interfaceRetryStore
- Throws:
InterlokException
-
delete
public boolean delete(java.lang.String msgId) throws InterlokException
Description copied from interface:RetryStore
Delete a message from the store (optional operation).- Specified by:
delete
in interfaceRetryStore
- Throws:
InterlokException
-
createForReport
protected static RemoteBlob createForReport(java.io.File baseDir)
-
withBaseUrl
public FilesystemRetryStore withBaseUrl(java.lang.String s)
-
getBaseUrl
public java.lang.String getBaseUrl()
The base URLfile:///...
where we can discover files.
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl)
The base URLfile:///...
where we can discover files.
-
-