API wise it could help you migrate once query side is out I guess.
The type of the stream is simply Source[Any, _] (can be done with T), so if the 
rest of your app depends on such then you could do it.

Getting backpressure will require some gymnastics but should be doable (don't 
poll if no demand - done via not scheduling recover messages).

-- 
Cheers,
Konrad 'ktoso’ Malawski
Akka @ Typesafe

On 17 July 2015 at 12:43:03, Giovanni Alberto Caporaletti (paradi...@gmail.com) 
wrote:

Hi Konrad
do you think that creating a "streams adapter" that exposes the current 
PersistentView as a stream and then switching to the new impl when it's stable 
would be a good idea?

On Friday, 17 July 2015 10:52:28 UTC+2, Konrad Malawski wrote:
Hi guys,
A few things to add to the discussion here :-)

Multiple journals are supported in Akka Persistence since 2.4-M1. 
https://github.com/akka/akka/issues/15587
In general 2.4 will include all the things that were missing in persistence in 
its experimental phase.

Push model:
Akka PersistentViews queries the datasource every 4-5 sek by default. If you 
worry much about the time it takes for propagation and do not want to hammer 
the database for quick updates, you can implement a push version of above. 
Please note that this introduces an extra write for the channel. 
Actually this is the Pull model. The PersistentView is pulling from the 
datastore. The datastore is not pushing to the view.

The new query side is actually pretty similar to streamz - it is a streams 
(akka streams) based abstraction on querying journals.
Also, these can actually be "push", you could hook up a Source to a pubsub or 
eventstream (the akka ones, or different ones) for example.
There will be a PR with it very soon, in general the direction is: 
(readJournal.query(...): Source[Any, _]) so you could .to(someOtherDatabaseSink)

On Thu, Jul 16, 2015 at 10:28 AM, haghard <hagh...@gmail.com> wrote:
-That looks like a convenient syntax that does the same thing as a persistent 
view does, tailored for users of scalaz streams, or am I missing something? 
Yes

-Can you take multiple eventlogs and combine them into one reproducible ordered 
stream. So that if you make decisions (validate preconditions against that read 
model) based on that stream, can you guarantee that the next replay up would 
recreate the same results? I think that is where it becomes very tricky.

The order you emit event is all up to you, scalaz-streams provide api for this 
purposes. 
You can build your read order based on some meta data in events or just read 
first available
For example 
 
https://github.com/haghard/sport-center/blob/b35ccec59c65c674334ff7a1836bb54e829a1ed5/query-side-results/src/main/scala/view/ResultsViewRouter.scala#L43
  

среда, 15 июля 2015 г., 19:33:19 UTC+3 пользователь Magnus Andersson написал:
Hi

Hagard: That looks like a convenient syntax that does the same thing as a 
persistent view does, tailored for users of scalaz streams, or am I missing 
something? 

Can you take multiple eventlogs and combine them into one reproducible ordered 
stream. So that if you make decisions (validate preconditions against that read 
model) based on that stream, can you guarantee that the next replay up would 
recreate the same results? I think that is where it becomes very tricky.

/Magnus

Den tisdag 14 juli 2015 kl. 13:51:25 UTC+2 skrev haghard:

Hi,

Please take a look at https://github.com/krasserm/streamz
You can read concrete journal with ```replay("processorA")``` and write in 
anywhere manually without interaction with PersistentView

Hope it helps

вторник, 14 июля 2015 г., 10:20:29 UTC+3 пользователь Amiri Barksdale написал:
I've been reading up here on PersistentActor, and I think I get how that works 
to perform commands and write the result to an event store. I also think I 
understand that PersistentViews can subscribe to a PersistentActor and receive 
notification of each event stored for that PersistentActor type. I want to take 
a PersistentView and use it to update a separate Read datastore.

I don't want to treat the PersistentView itself as a read store, but I want to 
make it trigger the creation or updating or saving of a "projection" of the 
event in some other store, like, e.g., Elasticsearch or Postgresql. Are there 
any guidelines, best practices, or examples of how to do this?

One thread 
(https://groups.google.com/forum/#!searchin/akka-user/persistentview/akka-user/rMHjwBZpocQ/SmfAGMg7G68J)
 from June 2014 seemed to indicate that this sort of writing to another store 
would require PersistentViews to be able to read from multiple PersistentActors 
for this to be feasible. Is this still true?

What is the path to take here, to get the actor system populating my read 
stores? Are people instead creating projections directly from the event store 
itself, like Greg Young's EventStore allows?

Any insight is welcome!

Amiri
--
>>>>>>>>>> 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,
Konrad 'ktoso' Malawski
Akka @ Typesafe
--
>>>>>>>>>> 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.

-- 
>>>>>>>>>>      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.

Reply via email to