0
ローカルのzookeeperとkafkaサーバとのメッセージの送受信にSpring Cloud Stream Kafka Bindingを使用しようとしています。Spring Cloud Stream Kafka:org.springframework.integration.MessageDispatchingException:ディスパッチャにサブスクライバがありません
Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:154) ~[spring-integration-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121) ~[spring-integration-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
... 28 common frames omitted
サーバは1クラスと1つのスプリングアプリケーションのプロパティファイル、非常に簡単です::
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import java.util.Map;
@RestController
@EnableBinding(ProducerChannels.class)
@SpringBootApplication
public class ProducerApplication {
private final MessageChannel consumer;
public ProducerApplication(ProducerChannels channels){
this.consumer = channels.consumer();
}
@PostMapping("/greet/{name}")
public void publish(@RequestBody Map<String, String> name){
String greeting = "Hello, " + name + "!";
Message<String> msg = MessageBuilder.withPayload(greeting).build();
consumer.send(msg);
}
public static void main(String[] args) {
SpringApplication.run(ProducerApplication.class, args);
}
}
interface ProducerChannels {
@Output
MessageChannel consumer();
}
BLOCKQUOTE 春Spring MVCのサーバを起動するときしかし、私は次の例外を見ています.cloud.stream.kafka.bindings.consumer.destination =消費者 はserver.port = 8080
他に何D o Spring Cloud Streamを設定する必要がありますか?