use of org.apache.kafka.streams.state.ReadOnlySessionStore in project kafka by apache.
the class CompositeReadOnlySessionStore method fetchSession.
@Override
public V fetchSession(final K key, final long earliestSessionEndTime, final long latestSessionStartTime) {
Objects.requireNonNull(key, "key can't be null");
final List<ReadOnlySessionStore<K, V>> stores = storeProvider.stores(storeName, queryableStoreType);
for (final ReadOnlySessionStore<K, V> store : stores) {
try {
return store.fetchSession(key, earliestSessionEndTime, latestSessionStartTime);
} catch (final InvalidStateStoreException ise) {
throw new InvalidStateStoreException("State store [" + storeName + "] is not available anymore" + " and may have been migrated to another instance; " + "please re-discover its location from the state metadata.", ise);
}
}
return null;
}
use of org.apache.kafka.streams.state.ReadOnlySessionStore in project kafka by apache.
the class CompositeReadOnlySessionStoreTest method shouldThrowInvalidStateStoreExceptionOnRebalance.
@Test
public void shouldThrowInvalidStateStoreExceptionOnRebalance() {
final QueryableStoreType<ReadOnlySessionStore<Object, Object>> queryableStoreType = QueryableStoreTypes.sessionStore();
final CompositeReadOnlySessionStore<String, String> store = new CompositeReadOnlySessionStore<>(new WrappingStoreProvider(singletonList(new StateStoreProviderStub(true)), StoreQueryParameters.fromNameAndType("whateva", queryableStoreType)), QueryableStoreTypes.sessionStore(), "whateva");
assertThrows(InvalidStateStoreException.class, () -> store.fetch("a"));
}
Aggregations