package io.quarkus.smallrye.reactivemessaging.runtime;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import io.quarkus.runtime.StartupEvent;
import io.smallrye.reactive.messaging.extension.MediatorManager;

@Dependent
public class SmallRyeReactiveMessagingLifecycle {

    @Inject
    MediatorManager mediatorManager;

    void onApplicationStart(@Observes StartupEvent event) {
        CompletableFuture<Void> future = mediatorManager.initializeAndRun();
        try {
            future.get();
        } catch (ExecutionException e) {
            throw new RuntimeException(e.getCause());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

}

@@ -53,104 +53,8 @@
 e;%0A%0A
-import java.util.concurrent.CompletableFuture;%0Aimport java.util.concurrent.ExecutionException;%0A%0A
 impo
@@ -451,40 +451,25 @@
     
-CompletableFuture%3CVoid%3E future =
+try %7B%0A           
  med
@@ -513,163 +513,17 @@
     
-try %7B%0A            future.get();%0A        %7D catch (ExecutionException e) %7B%0A            throw new RuntimeException(e.getCause());%0A        %7D catch (Interrupted
+%7D catch (
 Exce

Update how is started the Reactive Messaging provider