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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to