Re: [akka-user] Sending a message after Future(s) completion

2014-06-27 Thread √iktor Ҡlang
Happy hAkking!


On Fri, Jun 27, 2014 at 12:22 PM, Jasper  wrote:

> Oh I see, it looks better indeed. Thanks.
>
> Le vendredi 27 juin 2014 12:15:38 UTC+2, √ a écrit :
>>
>> Oh, it's even better, use "recover" instead of "recoverWith".
>>
>>
>> On Fri, Jun 27, 2014 at 12:14 PM, Jasper  wrote:
>>
>>> Missed to wrap the Nil in a Future, but it works perfect, thanks !
>>>
>>> Le vendredi 27 juin 2014 12:00:18 UTC+2, √ a écrit :

 WARNING: Did not try to compile this

 Future.sequence(
   futureFiles map { _ recoverWith { case ex => log.info("Retrieval of
 files failed : {}", ex.getLocalizedMessage); Nil } }
  ).map(lists => Detected(lists.flatten.toIndexedSeq)) pipeTo sender


 On Fri, Jun 27, 2014 at 11:22 AM, Jasper  wrote:

> Hello,
>
> Beginner here, I'm experiencing some issues with a particular portion
> of my code :
>
>   val paths = ListBuffer.empty[List[File]]
>   futureFiles.foreach{
> _.onComplete{
>   case Success(list: List[File]) =>
> paths += list
>   case Failure(ex) =>
> log.info("Retrieval of files failed : {}",
> ex.getLocalizedMessage)
> }
>   }
>   sender() ! Detected(paths.flatten.toIndexedSeq)
>
> futureFiles is a List[Future[List[File]]]. So I attach a callback on
> each of them and construct a new list from it. My problem is because this
> is asynchronous code, sometimes it will make the tell before the paths 
> list
> is filled up, thus sending nothing. I figured I'd try something like this 
> :
>
>   Future.sequence(futureFiles).onComplete{
>   case Success(lists) =>
> sender() ! Detected(lists.flatten.toIndexedSeq)
>   case Failure(ex) =>
> log.info("Retrieval of files failed : {}",
> ex.getLocalizedMessage)
>   }
>
> But doing so I lose some failure messages because of the sequencing,
> and it doesn't work anyway because the message is going straight to dead
> letters. So how can I achieve this ?
>
> Thanks
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ: http://doc.akka.io/docs/akka/c
> urrent/additional/faq.html
> >> Search the archives: https://groups.google.com/grou
> p/akka-user
> ---
> You received this message because you are subscribed to the Google
> Groups "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to akka-user+...@googlegroups.com.
> To post to this group, send email to akka...@googlegroups.com.
>
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



 --
 Cheers,
 √

>>>  --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ: http://doc.akka.io/docs/akka/
>>> current/additional/faq.html
>>> >> Search the archives: https://groups.google.com/
>>> group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Cheers,
>> √
>>
>  --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://gro

Re: [akka-user] Sending a message after Future(s) completion

2014-06-27 Thread Jasper
Oh I see, it looks better indeed. Thanks.

Le vendredi 27 juin 2014 12:15:38 UTC+2, √ a écrit :
>
> Oh, it's even better, use "recover" instead of "recoverWith".
>
>
> On Fri, Jun 27, 2014 at 12:14 PM, Jasper 
> > wrote:
>
>> Missed to wrap the Nil in a Future, but it works perfect, thanks !
>>
>> Le vendredi 27 juin 2014 12:00:18 UTC+2, √ a écrit :
>>>
>>> WARNING: Did not try to compile this
>>>
>>> Future.sequence(
>>>   futureFiles map { _ recoverWith { case ex => log.info("Retrieval of 
>>> files failed : {}", ex.getLocalizedMessage); Nil } }
>>>  ).map(lists => Detected(lists.flatten.toIndexedSeq)) pipeTo sender
>>>
>>>
>>> On Fri, Jun 27, 2014 at 11:22 AM, Jasper  wrote:
>>>
 Hello,

 Beginner here, I'm experiencing some issues with a particular portion 
 of my code :

   val paths = ListBuffer.empty[List[File]]
   futureFiles.foreach{
 _.onComplete{
   case Success(list: List[File]) =>
 paths += list
   case Failure(ex) =>
 log.info("Retrieval of files failed : {}", 
 ex.getLocalizedMessage)
 }
   }
   sender() ! Detected(paths.flatten.toIndexedSeq)

 futureFiles is a List[Future[List[File]]]. So I attach a callback on 
 each of them and construct a new list from it. My problem is because this 
 is asynchronous code, sometimes it will make the tell before the paths 
 list 
 is filled up, thus sending nothing. I figured I'd try something like this :

   Future.sequence(futureFiles).onComplete{
   case Success(lists) =>
 sender() ! Detected(lists.flatten.toIndexedSeq)
   case Failure(ex) =>
 log.info("Retrieval of files failed : {}", 
 ex.getLocalizedMessage)
   }

 But doing so I lose some failure messages because of the sequencing, 
 and it doesn't work anyway because the message is going straight to dead 
 letters. So how can I achieve this ?

 Thanks
  
 -- 
 >> Read the docs: http://akka.io/docs/
 >> Check the FAQ: http://doc.akka.io/docs/akka/
 current/additional/faq.html
 >> Search the archives: https://groups.google.com/
 group/akka-user
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Akka User List" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to akka-user+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.

 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>> Cheers,
>>> √
>>>  
>>  -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> √
>  

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Sending a message after Future(s) completion

2014-06-27 Thread √iktor Ҡlang
Oh, it's even better, use "recover" instead of "recoverWith".


On Fri, Jun 27, 2014 at 12:14 PM, Jasper  wrote:

> Missed to wrap the Nil in a Future, but it works perfect, thanks !
>
> Le vendredi 27 juin 2014 12:00:18 UTC+2, √ a écrit :
>>
>> WARNING: Did not try to compile this
>>
>> Future.sequence(
>>   futureFiles map { _ recoverWith { case ex => log.info("Retrieval of
>> files failed : {}", ex.getLocalizedMessage); Nil } }
>>  ).map(lists => Detected(lists.flatten.toIndexedSeq)) pipeTo sender
>>
>>
>> On Fri, Jun 27, 2014 at 11:22 AM, Jasper  wrote:
>>
>>> Hello,
>>>
>>> Beginner here, I'm experiencing some issues with a particular portion of
>>> my code :
>>>
>>>   val paths = ListBuffer.empty[List[File]]
>>>   futureFiles.foreach{
>>> _.onComplete{
>>>   case Success(list: List[File]) =>
>>> paths += list
>>>   case Failure(ex) =>
>>> log.info("Retrieval of files failed : {}",
>>> ex.getLocalizedMessage)
>>> }
>>>   }
>>>   sender() ! Detected(paths.flatten.toIndexedSeq)
>>>
>>> futureFiles is a List[Future[List[File]]]. So I attach a callback on
>>> each of them and construct a new list from it. My problem is because this
>>> is asynchronous code, sometimes it will make the tell before the paths list
>>> is filled up, thus sending nothing. I figured I'd try something like this :
>>>
>>>   Future.sequence(futureFiles).onComplete{
>>>   case Success(lists) =>
>>> sender() ! Detected(lists.flatten.toIndexedSeq)
>>>   case Failure(ex) =>
>>> log.info("Retrieval of files failed : {}",
>>> ex.getLocalizedMessage)
>>>   }
>>>
>>> But doing so I lose some failure messages because of the sequencing, and
>>> it doesn't work anyway because the message is going straight to dead
>>> letters. So how can I achieve this ?
>>>
>>> Thanks
>>>
>>> --
>>> >> Read the docs: http://akka.io/docs/
>>> >> Check the FAQ: http://doc.akka.io/docs/akka/
>>> current/additional/faq.html
>>> >> Search the archives: https://groups.google.com/
>>> group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Cheers,
>> √
>>
>  --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Sending a message after Future(s) completion

2014-06-27 Thread Jasper
Missed to wrap the Nil in a Future, but it works perfect, thanks !

Le vendredi 27 juin 2014 12:00:18 UTC+2, √ a écrit :
>
> WARNING: Did not try to compile this
>
> Future.sequence(
>   futureFiles map { _ recoverWith { case ex => log.info("Retrieval of 
> files failed : {}", ex.getLocalizedMessage); Nil } }
>  ).map(lists => Detected(lists.flatten.toIndexedSeq)) pipeTo sender
>
>
> On Fri, Jun 27, 2014 at 11:22 AM, Jasper 
> > wrote:
>
>> Hello,
>>
>> Beginner here, I'm experiencing some issues with a particular portion of 
>> my code :
>>
>>   val paths = ListBuffer.empty[List[File]]
>>   futureFiles.foreach{
>> _.onComplete{
>>   case Success(list: List[File]) =>
>> paths += list
>>   case Failure(ex) =>
>> log.info("Retrieval of files failed : {}", 
>> ex.getLocalizedMessage)
>> }
>>   }
>>   sender() ! Detected(paths.flatten.toIndexedSeq)
>>
>> futureFiles is a List[Future[List[File]]]. So I attach a callback on each 
>> of them and construct a new list from it. My problem is because this is 
>> asynchronous code, sometimes it will make the tell before the paths list is 
>> filled up, thus sending nothing. I figured I'd try something like this :
>>
>>   Future.sequence(futureFiles).onComplete{
>>   case Success(lists) =>
>> sender() ! Detected(lists.flatten.toIndexedSeq)
>>   case Failure(ex) =>
>> log.info("Retrieval of files failed : {}", 
>> ex.getLocalizedMessage)
>>   }
>>
>> But doing so I lose some failure messages because of the sequencing, and 
>> it doesn't work anyway because the message is going straight to dead 
>> letters. So how can I achieve this ?
>>
>> Thanks
>>  
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> √
>  

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Sending a message after Future(s) completion

2014-06-27 Thread √iktor Ҡlang
WARNING: Did not try to compile this

Future.sequence(
  futureFiles map { _ recoverWith { case ex => log.info("Retrieval of files
failed : {}", ex.getLocalizedMessage); Nil } }
 ).map(lists => Detected(lists.flatten.toIndexedSeq)) pipeTo sender


On Fri, Jun 27, 2014 at 11:22 AM, Jasper  wrote:

> Hello,
>
> Beginner here, I'm experiencing some issues with a particular portion of
> my code :
>
>   val paths = ListBuffer.empty[List[File]]
>   futureFiles.foreach{
> _.onComplete{
>   case Success(list: List[File]) =>
> paths += list
>   case Failure(ex) =>
> log.info("Retrieval of files failed : {}",
> ex.getLocalizedMessage)
> }
>   }
>   sender() ! Detected(paths.flatten.toIndexedSeq)
>
> futureFiles is a List[Future[List[File]]]. So I attach a callback on each
> of them and construct a new list from it. My problem is because this is
> asynchronous code, sometimes it will make the tell before the paths list is
> filled up, thus sending nothing. I figured I'd try something like this :
>
>   Future.sequence(futureFiles).onComplete{
>   case Success(lists) =>
> sender() ! Detected(lists.flatten.toIndexedSeq)
>   case Failure(ex) =>
> log.info("Retrieval of files failed : {}",
> ex.getLocalizedMessage)
>   }
>
> But doing so I lose some failure messages because of the sequencing, and
> it doesn't work anyway because the message is going straight to dead
> letters. So how can I achieve this ?
>
> Thanks
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Sending a message after Future(s) completion

2014-06-27 Thread Jasper
Hello,

Beginner here, I'm experiencing some issues with a particular portion of my 
code :

  val paths = ListBuffer.empty[List[File]]
  futureFiles.foreach{
_.onComplete{
  case Success(list: List[File]) =>
paths += list
  case Failure(ex) =>
log.info("Retrieval of files failed : {}", 
ex.getLocalizedMessage)
}
  }
  sender() ! Detected(paths.flatten.toIndexedSeq)

futureFiles is a List[Future[List[File]]]. So I attach a callback on each 
of them and construct a new list from it. My problem is because this is 
asynchronous code, sometimes it will make the tell before the paths list is 
filled up, thus sending nothing. I figured I'd try something like this :

  Future.sequence(futureFiles).onComplete{
  case Success(lists) =>
sender() ! Detected(lists.flatten.toIndexedSeq)
  case Failure(ex) =>
log.info("Retrieval of files failed : {}", 
ex.getLocalizedMessage)
  }

But doing so I lose some failure messages because of the sequencing, and it 
doesn't work anyway because the message is going straight to dead letters. 
So how can I achieve this ?

Thanks

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.