spring-cloud / spring-cloud/spring-cloud-stream
Producer (fn) stops after there's an error [Kafka binder]
Open
@olegz is already working on this.
Since Jul 28, 2020.
waiting-on-feedback
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 646
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Description
I have setup a stream producer using spring-cloud-function, which works fine until there's an exception then it stops producing.
Steps to reproduce the behavior:
class Producer {
public static EmitterProcessor<String> produce = EmitterProcessor.create();
}
@Configuration
class BeanConfig {
@Bean
Supplier<Flux<String>> producer() {
return () -> Producer.produce;
}
}
@Component
class Listener {
@EventListener
void onSomeEvent(SomeEvent<String> event) {
var dto = event.getEvent();
Producer.produce.onNext(dto);
}
}
spring:
cloud:
function:
definition: producer
stream:
kafka:
binder:
brokers: localhost
bindings:
producer-out-0:
destination: some-topic
Version of the framework
- Spring-Boot: 2.3.0.RELEASE
- Spring-Cloud: Hoxton.SR5 (
spring-cloud-stream-binder-kafka)
Expected behavior
The application should keep producing after an exception is encountered. I added an error handler but it doesn't seem to fix it.
@Bean
Supplier<Flux<String>> producer() {
return () -> Producer.produce.onErrorResume(e -> Mono.empty());
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.