我遵循以下活动路线指南:https://docs.spring.io/spring-cloud-stream/docs/3.2.5-SNAPSHOT/reference/html/spring-cloud-stream.html#_event_routing
这是Kinesis生成器的配置
cloud:
stream:
bindings:
produceMessage-out-0:
binder: kinesis
destination: 'kinesis-stream-name'
content-type: application/json
这是针对Kinesis消费者的配置:
spring:
cloud:
function:
definition: even;odd
stream:
function:
routing:
enabled: true
bindings:
even-in-0:
destination: 'kinesis-stream-name'
content-type: application/json
odd-in-0:
destination: 'kinesis-stream-name'
content-type: application/json
我正在生成消息并使用StreamBridge设置‘type’标头:
streamBridge.send("kinesis-stream-name", MessageBuilder.withPayload("10").setHeader("type","odd").build());
然而,‘type’标头不存在于消费者中,因此路由对我不起作用。
我做错了什么?
1条答案
按热度按时间oxcyiej71#
我们必须将以下代码添加到生产者配置中: