Hi Brice,
Both the PersistentActor and the PersistentView needs to be "recovered". What
the documentation is referring to is that you can customize the behavior of the
recovery by overriding preRestart, not that you can completely disable it.
Doing this in your view works just fine.
// disable recovery
override def preStart() = { self ! Recover(replayMax = 0) }
B/
On 31 October 2014 at 11:55:35, Brice Figureau ([email protected])
wrote:
Hi,
It looks like a View can't work if I disable its recovery.
For my specific case I really don't care about the recovery since this
view is just storing its events in a different datastore (and format)
than the original journal.
For instance this short test doesn't work:
class TestPersistentActor extends PersistentActor with ActorLogging {
override def persistenceId = "test"
def receiveRecover = Actor.emptyBehavior
def receiveCommand = LoggingReceive {
case "test" => persist("test") { e =>
sender() ! "done"
}
}
}
class TestPersistentView extends PersistentView with ActorLogging {
override def persistenceId = "test"
override def viewId = "view"
override def autoUpdateInterval: FiniteDuration = 50.millis
// disable recovery
override def preStart() = {}
var seenTest = false
def receive = LoggingReceive {
case "test" if isPersistent => seenTest = true
case "check" => sender() ! seenTest
}
}
...
it("should work") {
val probe = TestProbe()
val view: ActorRef = system.actorOf(Props(new TestPersistentView()), name =
"view")
val actor: ActorRef = system.actorOf(Props(new TestPersistentActor()), name =
"actor")
actor.!("test")(probe.ref)
probe.expectMsg("done")
Thread.sleep(500)
view.!("check")(probe.ref)
probe.expectMsg(true)
}
The documentation says that it works like PersistentActor recovery
(which also explains how to prevent recovery).
Is that a bug or did I miss something?
--
Brice Figureau
My Blog: http://www.masterzen.fr/
--
>>>>>>>>>> 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.
--
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson
--
>>>>>>>>>> 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.