title: What is most efficient way to write this webflux code?
body: <p>I have this code . In method A , I have to call b.subcribe(). without it method B will not executed. what is efficient way to call it without using subscibe. I feel like subcribe is not right way here</p>
  <pre><code>public static void main(String[] args) {
          Test t = new Test();
          Mono&lt;Integer&gt; a = t.A();
  
          System.out.println(System.currentTimeMillis()/1000);
          a.subscribe(a1-&gt; System.out.println(a1));
          System.out.println(System.currentTimeMillis()/1000);
  
      }
  
       Mono&lt;Integer&gt; A(){
           Mono&lt;Integer&gt; integerMono = Mono.fromCallable(() -&gt; {
  
               System.out.println(&quot;Hello&quot;);
               Thread.sleep(2000);
               return 1;
           });
  
  
           Mono&lt;Integer&gt; b = integerMono.flatMap(this::B);
  
           b.subscribe();
  
           return integerMono;
       }
  
      Mono&lt;Integer&gt; B(int a ){
          return Mono.fromCallable(() -&gt; {
              System.out.println(&quot;B method&quot;);
              Thread.sleep(1000);
              return a * 100;
          });
  
      }
  </code></pre>
  <p>I have found another way to avoid subscribe. Not sure it is the best way</p>
  <pre><code>Mono&lt;Integer&gt; A(){
           Mono&lt;Integer&gt; integerMono = Mono.fromCallable(() -&gt; {
  
               System.out.println(&quot;Hello&quot;);
               Thread.sleep(2000);
               return 1;
           });
  
           
           return integerMono.flatMap(
                   a -&gt; {
                       return this.B(a).map(x-&gt;a);
                   }
           );
       }
  </code></pre>