Try to search your question here, if you can't find : Ask Any Question Now ?

Flux blocking Netty start-up

HomeCategory: stackoverflowFlux blocking Netty start-up
Avatarkundan asked 4 months ago

I have a @Repository reading from a real-time data source. I am making the data available using Flux.create() { sink->sink.next() }

A @Service is doing the following;

@Autowired MyRepository myRepository;

@PostConstruct() public void startUp() {
  ConnectableFlux<Object> cf = myRepository.flux.publish();
  cf.subscribe(System.out::println);
  cf.connect();
}

That works and prints the data, but I do not get “Netty started” in the logs and @Controllers do not respond. If I omit cf.connect(), Netty starts. So I assume that cf.connect() is blocking Netty.

Ideally, I want the subscription to auto-start. Is using connect() in @PostConstuct too early? Should I listen for a “Netty Started” event, then connect(), or is my subscription just plain wrong?

Edit: If connect is run within a deamon Thread, Netty does start and the subscription works.

1 Answers
Best Answer
AvatarFernando answered 4 months ago
Your Answer

20 + 19 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com