T
- as Token
public interface BatchService<B extends Batch<T>,T extends Token<T>> extends TokenContainerService<T,B>
Batch
Modifier and Type | Method and Description |
---|---|
List<T> |
add(B batch,
List<T> token,
Consumer<T> consumer,
TokenEvent<T> tokenEvent) |
B |
determineRoute(T token)
|
Batch<T> |
getBatch(String id)
Fetch a Batch by Id
|
List<T> |
getInProcess(B tokenContainer)
Tokens that out of the Q but being processed
|
default Integer |
getPermissableBatchSize()
How many tokens to support per Batch
|
List<T> |
getPreProcess(B tokenContainer)
Tokens that are not yet eligible to be in Q but are being considered.
|
List<T> |
getProcessed(B tokenContainer)
Tokens that out of the Q and processed
|
List<T> |
getReadyToBeProcessed(B tokenContainer,
T lastToken)
Get tokens ready to be processed; from lastToken (excluding it)
|
List<T> |
getTokens(B tokenContainer)
Get all tokens ever
|
List<T> |
getTokens(B tokenContainer,
T lastToken,
Collection states)
Fetch tokens across multiple states @ once
|
T |
poll(B batch)
Poll then next token READY to be served.
|
default Number |
size(B batch)
# of tokens Tokens that are in the
TokenContainer . |
getAssignedContainer, getMaxResultSize, getPositions, getQStatesStrategy, getSequence, getType, hasNext, init, linkTokens, lookup, lookupById, lookupBySequence, lookupBySequence, move, poll, poll, poll, remove, save, update, updateStatus, updateStatus
T poll(B batch)
QStatesStrategy.getReadyToBeProcessed()
poll
in interface TokenContainerService<T extends Token<T>,B extends Batch<T>>
batch
- as container type Token
within the container. null if noneQueue.poll()
List<T> add(B batch, List<T> token, Consumer<T> consumer, TokenEvent<T> tokenEvent) throws TokenProcessingException
add
in interface TokenContainerService<T extends Token<T>,B extends Batch<T>>
batch
- as container type token
- as List of Token
sconsumer
- as Consumer
to apply an anonymous function at runtime over the Token elements iterated; after they are added. nullable truetokenEvent
- as TokenEventList
of Token
s that were addedTokenProcessingException
Queue.add(Object)
B determineRoute(T token) throws TokenProcessingException
token
- TokenProcessingException
List<T> getReadyToBeProcessed(B tokenContainer, T lastToken)
tokenContainer
- as container type lastToken
- as Token
type List
of Token
sQStatesStrategy
List<T> getPreProcess(B tokenContainer)
tokenContainer
- as container type List
of Token
sQStatesStrategy
List<T> getInProcess(B tokenContainer)
tokenContainer
- as container type List
of Token
sQStatesStrategy
,
#getProcessed(TokenContainer)
List<T> getProcessed(B tokenContainer)
tokenContainer
- as container type List
of Token
sQStatesStrategy
,
#getInProcess(TokenContainer)
List<T> getTokens(B tokenContainer, T lastToken, Collection states)
tokenContainer
- as container type lastToken
- as Token
type states
- as Collection
of STATEsList
of Token
sdefault Number size(B batch)
TokenContainer
.
If the container is a finite state container then it will be the actual size of it, else
if a stream then the count of tokens in #getReadyToBeProcessed(TokenContainer, Token)
.
This is an idempotent operation.size
in interface TokenContainerService<T extends Token<T>,B extends Batch<T>>
batch
- as TokenContainer
type default Integer getPermissableBatchSize()
Copyright © 2018. All rights reserved.