title: how to combine two publisher in one in spring reactor
body: <p>I have implemented a dummy reactive repository but I am struggling with the update method:</p>
  
  <pre><code>@Override
  public Mono&lt;User&gt; updateUser(int id, Mono&lt;User&gt; updateMono) {
      return  //todo with getUser
  }
  
  @Override
  public Mono&lt;User&gt; getUser(int id) {
      return Mono.justOrEmpty(this.users.get(id));
  }
  </code></pre>
  
  <p>From one hand I have incoming publisher <code>Mono&lt;User&gt; updateMono</code>, from the other hand I have another publisher during <code>Mono.justOrEmpty(this.users.get(id))</code>. </p>
  
  <p>How to combine it together, make update, and give back just one publisher?</p>
  
  <p>The only thing come to my mind is:</p>
  
  <pre><code>@Override
  public Mono&lt;User&gt; updateUser(int id, Mono&lt;User&gt; updateMono) {
      return  getUser(id).doOnNext(user -&gt; {
          updateMono.subscribe(update -&gt; {
              users.put(id, new User(id, update.getName(), update.getAge()));
              System.out.format("Updated user with id %d to %s%n", id, update);
          });
      });
  }
  </code></pre>
  
  <p>Is it correct?</p>