...
To distinguish different types of error, we need to handle all InvalidStateStoreExceptions better during these public methods invoked. The main change is to introduce new exceptions that extend from InvalidStateStoreException. InvalidStateStoreException is not thrown at all anymore, but only new sub-classes.
Code Block | ||
---|---|---|
| ||
# Two category exceptions public class RetryableStateStoreExceptionStreamsNotStartedException extends InvalidStateStoreException public class FatalStateStoreExceptionStreamsRebalancingException extends InvalidStateStoreException # Retryable exceptions public class StreamsNotStartedException extends RetryableStateStoreException public class StreamsRebalancingException extends RetryableStateStoreException public class StateStoreMigratedException extends RetryableStateStoreException # Fatal exceptionsInvalidStateStoreException public class StreamsNotRunningException extends FatalStateStoreException public class StateStoreNotAvailableException extends FatalStateStoreExceptionInvalidStateStoreException public class UnknownStateStoreException extends FatalStateStoreException |
Various state store exceptions can classify into two category exceptions: RetryableStateStoreException and FatalStateStoreException. The user can use the two exceptions if they only need to distinguish whether it can retry.
InvalidStateStoreException
|
- Retryable exceptionsStreamsNotStartedException: will be thrown when streams stream thread state is CREATEDis CREATED, the user can retry until to RUNNING.
- StreamsRebalancingException: will be thrown when streams stream thread is not running and stream state is REBALANCINGis REBALANCING, the user just retry and wait until rebalance finished (RUNNING).
- StateStoreMigratedException: will be thrown when state store already closed and stream state is RUNNING. The user need to rediscover the store and cannot blindly retry as the store handle is invalid and a new store handle must be retrived.
- Fatal exceptionsStateStoreNotAvailableException: will be thrown when state store closed and stream state is PENDING_SHUTDOWN / NOT_RUNNING / ERROR. The user cannot retry when this exception is thrown.
- UnknownStateStoreException: will be thrown when passing an unknown state store.
The following is the public methods that users will call to get state store instance:
...
Info |
---|
Throw exceptions: StreamsNotStartedException, StreamsRebalancingException, StreamsNotRunningException StateStoreNotAvailableException, UnknownStateStoreException |
The following is the public methods that users will call to get store values:
...
Info |
---|
All the above methods could be throw following exceptions: StreamsRebalancingException, StateStoreMigratedException, StreamsNotRunningException, StateStoreNotAvailableException |
...