use of io.confluent.ksql.execution.streams.materialization.NotRunningException in project ksql by confluentinc.
the class KsStateStore method store.
<T> T store(final QueryableStoreType<T> queryableStoreType, final int partition) {
try {
final boolean enableStaleStores = ksqlConfig.getBoolean(KsqlConfig.KSQL_QUERY_PULL_ENABLE_STANDBY_READS);
final boolean sharedRuntime = kafkaStreams instanceof KafkaStreamsNamedTopologyWrapper;
final StoreQueryParameters<T> parameters = sharedRuntime ? NamedTopologyStoreQueryParameters.fromNamedTopologyAndStoreNameAndType(queryId, stateStoreName, queryableStoreType).withPartition(partition) : StoreQueryParameters.fromNameAndType(stateStoreName, queryableStoreType).withPartition(partition);
return enableStaleStores ? kafkaStreams.store(parameters.enableStaleStores()) : kafkaStreams.store(parameters);
} catch (final Exception e) {
final State state = kafkaStreams.state();
if (state != State.RUNNING) {
throw new NotRunningException("The query was not in a running state. state: " + state);
}
throw new MaterializationException("State store currently unavailable: " + stateStoreName, e);
}
}
Aggregations