Comments (4)
Depends on spring-cloud/spring-cloud-stream#519
from spring-cloud-stream-binder-kafka.
Duplicated by #144
from spring-cloud-stream-binder-kafka.
@mbogoevici It's great to have KStreams available directly in Spring Cloud Streams. I only miss one thing:
With Spring Kafka I wanted to use interative queries so I configured KStreams like this to generate a KTable:
KStream<Integer, JsonNode> stream = kStreamBuilder.stream(integerSerde, jsonSerde, STREAMING_TOPIC1);
stream.map( (key, value) -> {
return new KeyValue<>(value.get("productId").asInt(), value.get("quantity").asInt());
}).groupByKey().reduce( (v1, v2) -> v1 + v2, "ProductsStock");
Then in my business service I injected KStreamBuilderFactoryBean
to have access to KafkaStreams
and thus be able to implement the query against the previously defined store:
@Autowired
private KStreamBuilderFactoryBean kStreamBuilderFactoryBean;
@Override
public Integer getProductStock(Integer id) {
KafkaStreams streams = kStreamBuilderFactoryBean.getKafkaStreams();
ReadOnlyKeyValueStore<Integer, Integer> keyValueStore =
streams.store("ProductsStock", QueryableStoreTypes.keyValueStore());
return keyValueStore.get(id);
}
Do we have to do the same to use the interactive queries when using Spring Cloud Streams?
from spring-cloud-stream-binder-kafka.
Yes, according to the code in the PR #159 from @sobychacko , we have:
@Bean(name = KafkaStreamsDefaultConfiguration.DEFAULT_KSTREAM_BUILDER_BEAN_NAME)
public KStreamBuilderFactoryBean defaultKStreamBuilder(
So, that is really feasible what we have discussed with you in the spring-projects/spring-kafka#365
Why do you think that might be something different?
Thanks for your feedback though!
from spring-cloud-stream-binder-kafka.
Related Issues (20)
- Live producer threads and dynamic-destination-cache-size property HOT 2
- How to wait for future inside Kafka Stream map()? HOT 2
- DefaultErrorHandler not exists HOT 4
- ClassCastException in pipeline: Kafka Streams Function -> Kafka Function -> Kafka Streams Consumer HOT 5
- NOT_ENOUGH_REPLICAS Errors After Upgrading The Spring Boot And Spring Cloud Version HOT 5
- KafkaBinderMetrics prevent JVM shutdown due to not shutting down scheduler thread pool! HOT 8
- Kafka bindings from previous test class remains active in the next test class HOT 2
- Kafka Streams Serdes having nested generic doesn't work HOT 3
- Support for DLQ in batch mode HOT 1
- spring.cloud.stream.bindings.process-in-0.consumer.concurrency not working in case of UpperCase letter in process name HOT 1
- ListenerContainerWithDlqAndRetryCustomizer template points to localhost:9092 HOT 5
- Looking for a sample with AWS MSK IAM
- [Feature Request] Allow to accept a list of customizers instead of a unique one for KafkaMessageChannelBinder HOT 1
- spring-kafka-test is compile (not test) dependency of spring-cloud-stream-binder-kafka-streams:3.2.3 and 3.2.4
- Batch mode is not working HOT 1
- Unknown Autoconfigured KafkaAvroSerializer and KafkaAvroDeSerializers HOT 2
- Spring Cloud stream binder kafka DLQ Handling for Batching doesn't work HOT 2
- Enable DLQ with destinations as pattern
- Fetch message timestamp
- Health Check for Binders Always Shows 'UNKNOWN' Status Due to Empty binderHealthContributors Map (Missing Bean Configuration for ReactorKafkaBinderHealthIndicator?) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-stream-binder-kafka.