Hi Ahjohannessen,

Great. Thanks a lot for the code snippet.Simple code then thousand words. I 
will try this out in our code. 

How are you finding out the last sequence number of event which view 
received? 

We are creating instance of view from preStart() method of PersistentActor. 
If we have to create view with last sequence number, then PersistentActor 
has to know the last sequence number of event pulled by view. Correct me if 
I wrong or any other alternative.

-Prakhyat M M 

On Friday, 10 October 2014 16:07:35 UTC+5:30, ahjohannessen wrote:
>
> Prakhyat, I use something like the following code, (greatly simplied), for 
> starting a view from a specific sequence number:
>
> package demo
>
> import scala.concurrent.duration._
> import akka.actor.{ActorLogging, ActorRef, Props}
> import akka.persistence.PersistentView
>
> object CatchUp {
>
>   case class Settings(    fromSeqNr: Long = 1L,     maxBufferSize: Int = 100, 
>
>     idle: Option[FiniteDuration]) {
>
>     require(fromSeqNr > 0L, "fromSeqNr must be > 0")
>     require(maxBufferSize > 0, "maxBufferSize must be > 0")
>   }
> }
> trait CatchUp extends PersistentView with ActorLogging {
>   import CatchUp._
>   def settings: Settings
>   def receive: Receive = ???
>
>   override def lastSequenceNr: Long =
>     math.max(settings.fromSequenceNr - 1L, super.lastSequenceNr)
>
>   override def autoUpdateInterval: FiniteDuration =
>     settings.idle.getOrElse(super.autoUpdateInterval)
>
>   override def autoUpdateReplayMax: Long =
>     settings.maxBufferSize
> }
>
>

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
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