private final int port;
private final KafkaStreams streams;
+ private ReadOnlyKeyValueStore<String, Order> orders;
+
public DetailsService(ApplicationProperties config)
{
LOG.error("Could not close KafkaStreams!", ex);
}
});
+ streams.setStateListener((newState, oldState) ->
+ {
+ if (newState == KafkaStreams.State.RUNNING)
+ orders = streams.store(topic, QueryableStoreTypes.keyValueStore());
+ });
}
.build();
}
- ReadOnlyKeyValueStore<String, Order> orders;
- orders = streams.store(topic, QueryableStoreTypes.keyValueStore());
Order order = orders.get(id);
return order == null
? ResponseEntity.notFound().build()