Subscribe to supplier flux in background thread
Stops application from blowing up if there are messages available on startup and the broker is not there. There are still errors (failed messages), but it doesn't stop the app from starting. Maybe should be optional to fail fast?
This commit is contained in:
@@ -26,6 +26,7 @@ import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -41,7 +42,7 @@ public class SupplierInvokingMessageProducer<T> extends MessageProducerSupport {
|
||||
|
||||
@Override
|
||||
protected void doStart() {
|
||||
supplier().subscribe(m -> this.sendMessage(m));
|
||||
supplier().subscribeOn(Schedulers.elastic()).subscribe(m -> this.sendMessage(m));
|
||||
}
|
||||
|
||||
private Flux<Message<?>> supplier() {
|
||||
|
||||
Reference in New Issue
Block a user