I am not aware of currentEventsByPersistenceId, so started using 
eventsByPersistenceId. println to check if execution is reaching to end or 
not, yes it is printing all the events but `finalResult` is not being 
returned. 

On Sunday, December 4, 2016 at 10:25:34 PM UTC+5:30, Justin du coeur wrote:
>
> Hmm.  You're intentionally not using currentEventsByPersistenceId()?  And 
> your println() is showing 10 results?
>
> On Sun, Dec 4, 2016 at 11:23 AM, Srinivas <chu...@gmail.com <javascript:>> 
> wrote:
>
>> I am trying to get list of persistent events and send it as response(
>> Action.async). But I am not able to convert PersistenceQuery results to 
>> Future object. Here is the code
>>
>> val queries = 
>> PersistenceQuery(actorSystem).readJournalFor[CassandraReadJournal](CassandraReadJournal.Identifier)
>> val source: Source[EventEnvelope, NotUsed] = 
>> queries.eventsByPersistenceId("MYID", 0, Long.MaxValue)
>> val mappedSource: Source[JsValue, NotUsed] = source.mapAsync(1) { e =>
>>       e.event match {
>>         case l: String =>
>>            Future(Json.parse(l))
>>       }
>>    }
>> val finalResult: Future[List[JsValue]] = 
>> mappedSource.take(10).runFold(List[JsValue]())((a, b) => {
>>       println(a)
>>       a :+ b
>>     })
>> finalResult
>>
>> I am able to see prints within runFold, but finalResult was never 
>> returned. I even tried to Await, even after waiting for minutes, it 
>> never returned. This finalResult shows all the user activity wanted to 
>> send it as response as Action.async. Please let me know what is the way 
>> to convert Source to Future object
>>
>> -- 
>> >>>>>>>>>> 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 <javascript:>.
>> To post to this group, send email to akka...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to