我正在使用带有弹簧云功能的弹簧云流兔子活页夹并定义监听器,例如:
public Function<Flux<SomeObject>, Flux<OtherObject>> foo() {
//some code
}
我还将失败的消息重新路由到 DLQ。问题是发生致命错误org.springframework.messaging.converter.MessageConversionException
时。它不会像https://docs.spring.io/spring-amqp/reference/html/#exception-handlingConditionalRejectingErrorHandler
中提到的那样得到处理,并且永远循环。
有没有办法让这个工作ConditionalRejectingErrorHandler
?
现在我通过@ServiceActivator(inputChannel = "errorChannel")
自己使用和处理错误来解决问题。
依赖项:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
</dependencies>