<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    So instead of calling observers asynchronously you suggest turning
    observers into producers of CompletableFuture that will then be
    completed asynchronously?<br>
    <br>
    <div class="moz-cite-prefix">On 03/31/2015 06:21 PM, Romain
      Manni-Bucau wrote:<br>
    </div>
    <blockquote
cite="mid:CACLE=7P1_tHcKPgRmxL2VkxW19CsZobVpQ7X=nfQhsB3onWYZQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">// fire side
        <div>event.fireAsync(new LetTheWorldKnow()).thenRun(() -&gt;
          System.out.println("We did it!"));</div>
        <div><br>
        </div>
        <div>// observer side</div>
        <div>CompletableFuture iWantToKnow(@Observes LetTheWorldKnow
          event) {}</div>
        <div><br>
        </div>
        <div>// impl behavior would be like
          CompletableFuture.allOf(allObserverReturnedInstances) to be
          aligned on CompletableFuture behavior I think</div>
        <div><br>
        </div>
        <div>Am I clearer?</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">
                          <div><br>
                            <span style="font-size:small">Romain
                              Manni-Bucau</span><br>
                            <a moz-do-not-send="true"
                              href="https://twitter.com/rmannibucau"
                              target="_blank">@rmannibucau</a> |  <a
                              moz-do-not-send="true"
                              href="http://rmannibucau.wordpress.com"
                              target="_blank">Blog</a> | <a
                              moz-do-not-send="true"
                              href="https://github.com/rmannibucau"
                              target="_blank">Github</a> | <a
                              moz-do-not-send="true"
                              href="https://www.linkedin.com/in/rmannibucau"
                              target="_blank">LinkedIn</a> | <a
                              moz-do-not-send="true"
                              href="http://www.tomitribe.com"
                              target="_blank">Tomitriber</a></div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">2015-03-31 18:15 GMT+02:00 Sven
          Linstaedt <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:sven.linstaedt@gmail.com" target="_blank">sven.linstaedt@gmail.com</a>&gt;</span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>Hi Romain,</div>
              <div><br>
              </div>
              I am not sure, I have fully understand how an observer
              with <span style="font-size:12.8000001907349px">CompletableFuture could
                look like. Could you give us an example? </span>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">Afair </span><span
                  style="font-size:12.8000001907349px">CompletableFuture</span><span
                  style="font-size:12.8000001907349px"> was considered
                  to be used in the "trigger" side in order to track
                  async event invocation completion.</span></div>
              <div><span style="font-size:12.8000001907349px"><br>
                </span></div>
              <div><span style="font-size:12.8000001907349px">br, Sven</span></div>
            </div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">
                <div>
                  <div class="h5">2015-03-31 18:00 GMT+02:00 Romain
                    Manni-Bucau <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:rmannibucau@gmail.com"
                        target="_blank">rmannibucau@gmail.com</a>&gt;</span>:<br>
                  </div>
                </div>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div>
                    <div class="h5">
                      <div dir="ltr">Hi guys,
                        <div><br>
                        </div>
                        <div>on async topic if I followed we are at the
                          point where we are looking for an activation
                          on the observer side.</div>
                        <div><br>
                        </div>
                        <div>Since Java 8 has now CompletableFuture it
                          would be great to use it. Today the spec
                          doesnt use observer returned values so it is
                          mainly a bad practise to have one even if not
                          strictly forbidden - BTW never saw it in real
                          applications - plus spec is not compatible -
                          not specified at all - with CompletableFuture
                          since it is a new API so we can use it as a
                          marker.</div>
                        <div><br>
                        </div>
                        <div>This is quite interesting for few reasons:</div>
                        <div>1- we have our double activation</div>
                        <div>2- API is user friendly (observer is async
                          and has an async signature)</div>
                        <div>3- open door for future async enhancements
                          (hopefully not in CDI) with composition of
                          these observers</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>Only point I'm not sure is should these
                          observers support sync events. I don't see
                          anything blocking to do it but can have missed
                          something.</div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>wdyt?</div>
                        <span><font color="#888888">
                            <div><br clear="all">
                              <div>
                                <div>
                                  <div dir="ltr">
                                    <div>
                                      <div dir="ltr">
                                        <div>
                                          <div dir="ltr">
                                            <div>
                                              <div dir="ltr">
                                                <div><br>
                                                  <span
                                                    style="font-size:small">Romain
                                                    Manni-Bucau</span><br>
                                                  <a
                                                    moz-do-not-send="true"
href="https://twitter.com/rmannibucau" target="_blank">@rmannibucau</a>
                                                  |  <a
                                                    moz-do-not-send="true"
href="http://rmannibucau.wordpress.com" target="_blank">Blog</a> | <a
                                                    moz-do-not-send="true"
href="https://github.com/rmannibucau" target="_blank">Github</a> | <a
                                                    moz-do-not-send="true"
href="https://www.linkedin.com/in/rmannibucau" target="_blank">LinkedIn</a> |
                                                  <a
                                                    moz-do-not-send="true"
href="http://www.tomitribe.com" target="_blank">Tomitriber</a></div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </font></span></div>
                      <br>
                    </div>
                  </div>
                  _______________________________________________<br>
                  cdi-dev mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:cdi-dev@lists.jboss.org"
                    target="_blank">cdi-dev@lists.jboss.org</a><br>
                  <a moz-do-not-send="true"
                    href="https://lists.jboss.org/mailman/listinfo/cdi-dev"
                    target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
                  <br>
                  Note that for all code provided on this list, the
                  provider licenses the code under the Apache License,
                  Version 2 (<a moz-do-not-send="true"
                    href="http://www.apache.org/licenses/LICENSE-2.0.html"
                    target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>).
                  For all other ideas provided on this list, the
                  provider waives all patent and other intellectual
                  property rights inherent in such information.<br>
                </blockquote>
              </div>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
cdi-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a>

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a class="moz-txt-link-freetext" href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.</pre>
    </blockquote>
    <br>
  </body>
</html>