You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/21 06:12:44 UTC

[GitHub] jiangpengcheng commented on issue #3459: Wrap producer.send with Future

jiangpengcheng commented on issue #3459: Wrap producer.send with Future
URL: https://github.com/apache/incubator-openwhisk/pull/3459#issuecomment-374841982
 
 
   @rabbah you mean like this?:
   
   ```scala
   Future {
     blocking( producer.send(record) )
   } andThen {
     case Success(futureMetadata) =>
       try {
         produced.success(futureMetadata.get)
       } catch {
         case e: ExecutionException =>
           produced.failure(e.getCause)
       }
     case Failure(t) =>
       produced.failure(t)
   }
   ```
   
   As the return type of `producer.send(record)` is a `java.util.concurrent.Future<RecordMetadata>`, do you have any better idea to finish a scala `Promise` with a java `Future`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services