Package org.apache.camel.resume
Interface ResumeStrategy
-
- All Superinterfaces:
AutoCloseable
,Service
public interface ResumeStrategy extends Service
Defines a strategy for handling resume operations. Implementations can define different ways to handle how to resume processing records.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ResumeStrategy.UpdateCallBack
A callback that can be executed after the last offset is updated
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ResumeAdapter
getAdapter()
Gets an adapter for resuming operationsdefault <T extends ResumeAdapter>
TgetAdapter(Class<T> clazz)
Gets and adapter for resuming operationsResumeStrategyConfiguration
getResumeStrategyConfiguration()
default void
loadCache()
Loads the cache with the data currently available in this strategyvoid
setAdapter(ResumeAdapter adapter)
Sets an adapter for resuming operations with this strategyvoid
setResumeStrategyConfiguration(ResumeStrategyConfiguration resumeStrategyConfiguration)
void
updateLastOffset(OffsetKey<?> offsetKey, Offset<?> offsetValue)
Updates the last processed offsetvoid
updateLastOffset(OffsetKey<?> offsetKey, Offset<?> offset, ResumeStrategy.UpdateCallBack updateCallBack)
Updates the last processed offset<T extends Resumable>
voidupdateLastOffset(T offset)
Updates the last processed offset<T extends Resumable>
voidupdateLastOffset(T offset, ResumeStrategy.UpdateCallBack updateCallBack)
Updates the last processed offset
-
-
-
Field Detail
-
DEFAULT_NAME
static final String DEFAULT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setAdapter
void setAdapter(ResumeAdapter adapter)
Sets an adapter for resuming operations with this strategy- Parameters:
adapter
- the component-specific resume adapter
-
getAdapter
ResumeAdapter getAdapter()
Gets an adapter for resuming operations
-
getAdapter
default <T extends ResumeAdapter> T getAdapter(Class<T> clazz)
Gets and adapter for resuming operations- Type Parameters:
T
- the type of the adapter- Parameters:
clazz
- the class of the adapter- Returns:
- the adapter or null if it can't be cast to the requested class
-
loadCache
default void loadCache() throws Exception
Loads the cache with the data currently available in this strategy- Throws:
Exception
-
updateLastOffset
<T extends Resumable> void updateLastOffset(T offset) throws Exception
Updates the last processed offset- Parameters:
offset
- the offset to update- Throws:
Exception
- if unable to update the offset
-
updateLastOffset
<T extends Resumable> void updateLastOffset(T offset, ResumeStrategy.UpdateCallBack updateCallBack) throws Exception
Updates the last processed offset- Parameters:
offset
- the offset to updateupdateCallBack
- a callback to be executed after the updated has occurred (null if not available)- Throws:
Exception
- if unable to update the offset
-
updateLastOffset
void updateLastOffset(OffsetKey<?> offsetKey, Offset<?> offsetValue) throws Exception
Updates the last processed offset- Parameters:
offsetKey
- the offset key to updateoffsetValue
- the offset value to update- Throws:
Exception
- if unable to update the offset
-
updateLastOffset
void updateLastOffset(OffsetKey<?> offsetKey, Offset<?> offset, ResumeStrategy.UpdateCallBack updateCallBack) throws Exception
Updates the last processed offset- Parameters:
offsetKey
- the offset key to updateoffset
- the offset value to updateupdateCallBack
- a callback to be executed after the updated has occurred (null if not available)- Throws:
Exception
- if unable to update the offset
-
setResumeStrategyConfiguration
void setResumeStrategyConfiguration(ResumeStrategyConfiguration resumeStrategyConfiguration)
-
getResumeStrategyConfiguration
ResumeStrategyConfiguration getResumeStrategyConfiguration()
-
-