title: Quarkus: How to change a method from imperative to reactive
body: <p>I build a small Rest API to understand more about the Quarkus framework. Now I would like to start using the framework with its reactive API but I'm struggling to understand some concepts. Currently the project is using RESTEasy Reactive with Jackson, Hibernate Reactive with Panache and the Postgresql Reactive Client.</p>
  <p>This are my classes</p>
  <pre class="lang-java prettyprint-override"><code>@Table(name = &quot;cat_role&quot;)
  @Entity
  public class Role extends PanacheEntityBase {
      private static final long serialVersionUID = -2246110460374253942L;
  
      @Id
      @Column(name = &quot;id&quot;, nullable = false, updatable = false)
      @GeneratedValue
      public UUID id;
      
      @Enumerated(EnumType.STRING)
      @Column(name = &quot;name&quot;, nullable = false, length = 18)
      public UserRole name;
  
      public enum UserRole {
          Administrador, Asesor_Empresarial, Asesor_Academico, Alumno
      }
      
  }
  </code></pre>
  <p>Now in my service (imperative way) I do the following:</p>
  <p>Role.class</p>
  <pre class="lang-java prettyprint-override"><code>    public static Boolean existsRoleSeed(){
          return Role.count() &gt; 0;
      }
  
  </code></pre>
  <p>RoleService.class</p>
  <pre class="lang-java prettyprint-override"><code>    @Transactional
      public void seedRoles() {
          if (!Role.existsRoleSeed()) {
              for(Role.UserRole userRole: Role.UserRole.values()){
                  Role role = Role.builder()
                          .name(userRole)
                          .build();
                  
                  role.persist();
              }
          }
      }
  </code></pre>
  <p>This will obviously register all roles from the UserRole enum in the database and it is working correctly. What I am trying to achieve is to replicate this method but using the reactive form. These are the changes that I have made in the code</p>
  <p>Role.class</p>
  <pre class="lang-java prettyprint-override"><code>    public static Uni&lt;Boolean&gt; existsRoleSeed() {
          return Role.count().map(x -&gt; x &gt; 0);
      }
  </code></pre>
  <p>RoleService.class</p>
  <pre class="lang-java prettyprint-override"><code>    @ReactiveTransactional
      public void seedRoles() {
          Role.existsRoleSeed()
                  .map(exists -&gt; {
                      if (!exists) {
                          Multi.createFrom()
                                  .iterable(Arrays
                                          .stream(Role.UserRole.values())
                                          .map(userRole -&gt; Role.builder()
                                                  .name(userRole)
                                                  .build())
                                          .collect(Collectors.toList()))
                                  .map(role -&gt; role.persistAndFlush())
                                  .subscribe().with(item -&gt; LOGGER.info(&quot;Something happened&quot;), failure -&gt; LOGGER.info(&quot;Something bad happened&quot;));
                      }
                      return null;
                  }).subscribe().with(o -&gt; {
                  });
      }
  </code></pre>
  <p>When I run the application, it does not give any error, the logs show that something happened, the database creates the table, however it does not insert anything. I have tried it in different ways, however, I have not succeeded in making it work as I hope.</p>