...
Because of that, we should throw different exceptions for each type.
Proposed Changes
The main change is to introduce new exceptions that extend from InvalidStateStoreException. InvalidStateStoreException is not thrown at all anymore, but only new sub-classes.
There are the new exceptions:
Code Block | ||
---|---|---|
| ||
# Throw to user exception public class StateStoreMigratedException extends InvalidStateStoreException public class StateStoreRetryableException extends InvalidStateStoreException public class StateStoreFailException extends InvalidStateStoreException # Internal exception public class StateStoreClosedException extends InvalidStateStoreException public class StateStoreEmptyException extends InvalidStateStoreException public class StreamThreadNotRunningException extends InvalidStateStoreException |
Three categories exception throw to the user:
...
Three internal exceptions: StateStoreClosedException, StateStoreEmptyException, StreamThreadNotRunningException
The internal exception will be wrapped as user's category exception finally. The purpose of the internal exceptions is to distinguish between the different kinds of InvalidStateStoreException. For example, StreamThreadStateStoreProvider#stores() will throw StreamThreadNotRunningException(internal exception). And then the internal exception will be wrapped as StateStoreRetryableException or StateStoreFailException during the KafkaStreams.store() and throw to the user.
The following is the public method that users will call:
...