Package org.forgerock.am.cts.queue
Interface TaskDispatcher
-
public interface TaskDispatcher
TaskDispatcher operates as the coordinator of asynchronous task processing in the CTS persistence layer. It does so by mapping the creation of tasks to be performed to a method of processing those tasks. The intention is to decouple the caller from the storage mechanism to ensure high throughput and independence from the storage layer. The TaskDispatcher is unaware of theTaskExecutor
implementation that will be used to dispatch tasks to perform.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
continuousQuery(ContinuousQueryListener listener, TokenFilter tokenFilter)
Perform a continuous query against the persistent store and signal the results to the providedContinuousQueryListener
.Promise<Token,CoreTokenException>
create(Token token, Options options)
The CTS Token to create in the persistent store.Promise<PartialToken,CoreTokenException>
delete(String tokenId, Options options)
The Token ID, for a specific revision of the token, to delete from the persistent store.Promise<Collection<PartialToken>,CoreTokenException>
partialQuery(TokenFilter tokenFilter, Options options)
Perform a query against the persistent store and signal the results to the provided ResultHandler.Promise<PartialToken,CoreTokenException>
patch(String tokenId, TokenModifications modifications, Options options)
Patches a token in the persistent store.Promise<Collection<Token>,CoreTokenException>
query(TokenFilter tokenFilter, Options options)
Perform a query against the persistent store and signal the results to the provided ResultHandler.Promise<Token,CoreTokenException>
read(String tokenId, Options options)
The CTS Token to read from the persistent store.void
removeContinuousQueryListener(ContinuousQueryListener listener, TokenFilter tokenFilter)
Removes the suppliedContinuousQueryListener
from the query which is operating the suppliedTokenFilter
.void
startDispatcher()
Start the dispatcher.void
stopContinuousQuery(TokenFilter tokenFilter)
Stops aContinuousQuery
having removed all itsContinuousQueryListener
s.Promise<Token,CoreTokenException>
update(Token readState, Token updatedState, Options options)
The CTS Token to update in the persistent store.Promise<Token,CoreTokenException>
upsert(Token token, Options options)
The CTS Token to create or update in the persistent store.
-
-
-
Method Detail
-
startDispatcher
void startDispatcher()
Start the dispatcher.
-
create
Promise<Token,CoreTokenException> create(Token token, Options options) throws CoreTokenException
The CTS Token to create in the persistent store.- Throws:
CoreTokenException
- See Also:
TaskDispatcher
-
read
Promise<Token,CoreTokenException> read(String tokenId, Options options) throws CoreTokenException
The CTS Token to read from the persistent store. The provided ResultHandler will be notified when the read has been completed.- Throws:
CoreTokenException
- See Also:
ResultHandler
,TaskDispatcher
-
upsert
Promise<Token,CoreTokenException> upsert(Token token, Options options) throws CoreTokenException
The CTS Token to create or update in the persistent store.- Throws:
CoreTokenException
- See Also:
TaskDispatcher
-
update
Promise<Token,CoreTokenException> update(Token readState, Token updatedState, Options options) throws CoreTokenException
The CTS Token to update in the persistent store.- Throws:
CoreTokenException
- See Also:
TaskDispatcher
-
delete
Promise<PartialToken,CoreTokenException> delete(String tokenId, Options options) throws CoreTokenException
The Token ID, for a specific revision of the token, to delete from the persistent store.- Throws:
CoreTokenException
- See Also:
TaskDispatcher
-
query
Promise<Collection<Token>,CoreTokenException> query(TokenFilter tokenFilter, Options options) throws CoreTokenException
Perform a query against the persistent store and signal the results to the provided ResultHandler. Note: Because a query has no associated Token ID, this function will select a random queue to place theQueryTask
on. There is no guarantee that multiple query operations will be performed by the sameSeriesTaskExecutorThread
.- Throws:
CoreTokenException
- See Also:
ResultHandler
,TaskDispatcher
-
partialQuery
Promise<Collection<PartialToken>,CoreTokenException> partialQuery(TokenFilter tokenFilter, Options options) throws CoreTokenException
Perform a query against the persistent store and signal the results to the provided ResultHandler. Note: Because a query has no associated Token ID, this function will select a random queue to place thePartialQueryTask
on. There is no guarantee that multiple query operations will be performed by the sameSeriesTaskExecutorThread
.- Throws:
CoreTokenException
- See Also:
ResultHandler
,TaskDispatcher
-
continuousQuery
void continuousQuery(ContinuousQueryListener listener, TokenFilter tokenFilter) throws CoreTokenException
Perform a continuous query against the persistent store and signal the results to the providedContinuousQueryListener
. If aContinuousQuery
already exists for the providedTokenFilter
this method will simply add the listener to that query. Note: Because a continuous query has no associated Token ID, this function will select a random queue to place theQueryTask
on. There is no guarantee that multiple continuous query operations will be performed by the sameSeriesTaskExecutorThread
.- Throws:
CoreTokenException
- See Also:
ContinuousQueryListener
,TaskDispatcher
-
removeContinuousQueryListener
void removeContinuousQueryListener(ContinuousQueryListener listener, TokenFilter tokenFilter)
Removes the suppliedContinuousQueryListener
from the query which is operating the suppliedTokenFilter
. A continuous query that has no listeners will NOT be stopped, and may have further listeners added to it later.- Parameters:
listener
- Non null ResultHandler to notify.tokenFilter
- Non null TokenFilter.- See Also:
ContinuousQueryListener
,TaskDispatcher
-
stopContinuousQuery
void stopContinuousQuery(TokenFilter tokenFilter)
Stops aContinuousQuery
having removed all itsContinuousQueryListener
s. If no query exists for the filter this method performs no action.- Parameters:
tokenFilter
- Non null TokenFilter.
-
patch
Promise<PartialToken,CoreTokenException> patch(String tokenId, TokenModifications modifications, Options options) throws CoreTokenException
Patches a token in the persistent store.- Parameters:
tokenId
- The ID of the token to patch.modifications
- The set of modifications to make to the token.options
- Set of options to use for the request.- Throws:
CoreTokenException
- If there was a problem executing the patch operation.
-
-