spring-cloud-stream

Multiple @EnableBinding with Kafka Spring Cloud Stream

你。 提交于 2019-12-11 11:27:11
问题 I'm trying to set an Spring Boot Application listening to Kafka. I'm using Kafka Streams Binder. With one simple @EnableBinding @EnableBinding(StreamExample.StreamProcessor.class) public class StreamExample { @StreamListener(StreamProcessor.INPUT) @SendTo(StreamProcessor.OUTPUT) public KStream<String, String> process(KStream<String, String> input) { logger.info("Stream listening"); return input .peek(((key, value) -> logger.info("key = {} value = {}", key, value))); } interface

How can I have Spring integration channel dispatch to Kafka?

你。 提交于 2019-12-11 09:57:42
问题 I am new to kafka and tried to create a Spring boot app that takes a rest request and posts it to Kafka Queue. I posted the code snippets as I have. The request is received and then sent to the testlogchannel . I was anticipating based on the configuration that I have a JSON that will be posted to Kafka topic. I have a process consuming the messages using the command bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testlog --from-beginning . I notice that the messages

Correctly manage DLQ in Spring Cloud Stream Kafka

烂漫一生 提交于 2019-12-11 07:05:16
问题 I want manage a DLQ in Spring Cloud Stream using kafka. application.yaml server: port: 8091 eureka: client: serviceUrl: defaultZone: http://IP:8761/eureka spring: application: name: employee-consumer cloud: stream: kafka: binder: brokers: IP:9092 bindings: greetings-in: destination: greetings contentType: application/json greetings-out: destination: greetings contentType: application/json bindings: greetings-out: consumer: enableDlq: true dlqName: dead-out kafka: consumer: group-id: A As you

Migrating from RabbitMQ to Kafka and encountering possible issue with Spring Cloud Sleuth

喜欢而已 提交于 2019-12-11 06:47:19
问题 Given the example code, I'm encountering the following exception when I uncomment the spring-cloud-sleuth-stream dependency: org.springframework.messaging.MessageHandlingException: Missing header 'foo' for method parameter type [class java.lang.String] at org.springframework.messaging.handler.annotation.support.HeaderMethodArgumentResolver.handleMissingValue(HeaderMethodArgumentResolver.java:100) ~[spring-messaging-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.messaging.handler

Spring Cloud Stream - Aggregates

亡梦爱人 提交于 2019-12-11 04:57:47
问题 I'm trying to implement the proposed SCS aggregates, but I'm not sure to understand the real purpose of them, as the results I get surprise me. First, Here is the code... The source, a messages provider to be scheduled : @SpringBootApplication @EnableBinding(Source.class) public class SourceApplication { private final Logger logger = LoggerFactory.getLogger(SourceApplication.class); @Bean @InboundChannelAdapter(Source.OUTPUT) public MessageSource<String> createMessage() { return () -> {

Modify the message body from spring-cloud-stream app starter

天涯浪子 提交于 2019-12-11 04:24:53
问题 I am new to Spring Cloud Stream. My use case is to read from a file source and publish messages (to Kafka) for each line in the file. I have tried using the file source app starter (https://github.com/spring-cloud-stream-app-starters/file/tree/master/spring-cloud-starter-stream-source-file) and have been able to publish messages. However the I now need to tweak the body of the message before publishing. The app starter generates generic messages and I need to modify the structure before

Kafka - Delay binding until complex service initialisation has completed

被刻印的时光 ゝ 提交于 2019-12-11 04:07:44
问题 I'm using Spring Cloud Stream Kafka, but I have a particular service that has a complex start-up dependency (long-running) that can be rather fragile so would like to delay Kafka (consumer) binding until successful initialization is confirmed. How can I achieve this? 回答1: It's not currently possible with Spring Cloud Stream; you can do it by using Spring Kafka directly (e.g. @KafkaListener ) and set the container factory's autoStartup to false . Or with Spring Integration Kafka and do the

How to create a custom source app for spring-cloud-stream-app-starters project

╄→гoц情女王★ 提交于 2019-12-11 04:06:09
问题 I want to create a web-socket source (for spring-cloud-stream-app-starters ) which is currently not available on git hub. I went through some of the available sources but had some confusions, may be because I'm not familiar with the framework. Can I just create a spring boot application with Source binding and return the received packets from web-socket clients in an @InboundChannelAdapter(value = Source.OUTPUT) annotated method. ? Also how can I use WebSocketInboundChannelAdapter to start a

spring cloud stream kafka: “Dispatcher has no subscribers” error

♀尐吖头ヾ 提交于 2019-12-11 03:05:43
问题 I am testing spring cloud stream with kafka binder, but got an error Caused by: org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'unknown.channel.name'. ; pom.xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-stream</artifactId> <version>1.1.2

Spring Cloud Streams - Multiple dynamic destinations for sources and sinks

孤人 提交于 2019-12-11 02:08:13
问题 There was a change request on my system, which currently listens to multiple channels and send messages to multiple channels as well, but now the destination names will be in the database and change any time. I'm having trouble believing I'm the first one to come across this, but I see limited information out there. All I found is these 2... Dynamic sink destination: https://github.com/spring-cloud-stream-app-starters/router/tree/master/spring-cloud-starter-stream-sink-router, but how would