...
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 | ||
---|---|---|
| ||
# Throw to user exception - retryableTwo category exceptions public class RetryableStateStoreException extends InvalidStateStoreException public class FatalStateStoreException extends InvalidStateStoreException # Retryable exceptions public class StreamThreadNotStartedException extends InvalidStateStoreExceptionRetryableStateStoreException public class StreamThreadRebalancingException extends InvalidStateStoreExceptionRetryableStateStoreException public class StateStoreMigratedException extends InvalidStateStoreExceptionRetryableStateStoreException # Throw to user exception - not retryableFatal exceptions public class StreamThreadNotRunningException extends InvalidStateStoreExceptionFatalStateStoreException public class StateStoreFailedExceptionStateStoreNotAvailableException extends InvalidStateStoreExceptionFatalStateStoreException # Internal exceptionexceptions public class StateStoreIsEmptyException extends InvalidStateStoreException public class StateStoreClosedException extends InvalidStateStoreException |
- StateStoreClosedException: will be thrown when state store is not open. This is an internal exception and will be wrapped to StateStoreMigratedException or StateStoreFailedException laterStateStoreNotAvailableException later.
- StateStoreIsEmptyException: will be thrown when state store cannot be found in all StateStoreProviders. This is an internal exception, and will be wrapped to StateStoreMigratedException or StateStoreFailedException laterStateStoreNotAvailableException later.
- StreamThreadNotRunningException: will be thrown when stream thread is not running and stream state is PENDING_SHUTDOWN /
NOT_RUNNING / ERROR. The user cannot retry when this exception is thrown. - StreamThreadNotStartedException: will be thrown when stream thread is not running and stream state is CREATED, the user can retry until to RUNNING.
- StreamThreadRebalancingException: will be thrown when stream thread is not running and stream state is REBALANCING, the user just retry and wait until rebalance finished (RUNNING).
- StateStoreMigratedException: A wrapper for StateStoreClosedException / StateStoreIsEmptyException. Will be thrown when stream thread is RUNNING / REBALANCING. The user need to rediscover the state store.
- StateStoreFailedExceptionStateStoreNotAvailableException: A wrapper for StateStoreClosedException / StateStoreIsEmptyException. Will be thrown when stream thread is PENDING_SHUTDOWN / NOT_RUNNING / ERROR. The user cannot retry when this exception is thrown.
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.
The interface QueryableStoreType will append a new method:
...