The big difference is that when using akka-persistence the messages are not
stored immediately when placed in the mailbox. When you receive the
Persistent message in the Processor you know that it has been stored. The
sender can let go of the responsibility when it has received an explicit
acknowledgement message from the Processor.
A safe hand-off like that can also be implemented with a PersistentChannel.
This is rather close to a durable mailbox, but so much better.
class Endpoint extends Actor {
val channel = context.actorOf(PersistentChannel.props(
PersistentChannelSettings(redeliverInterval = 3.seconds, redeliverMax =
10,
replyPersistent = true)), name = "myChannel")
val destination = context.system / "jobManager"
import context.dispatcher
implicit val timeout = Timeout(5.seconds)
def receive = {
case job: Job =>
(channel ? Deliver(Persistent(job), destination)) map {
case _: Persistent => "OK: " + job.id
} recover {
case e => "FAILED: " + job.id
} pipeTo sender()
}
}
Cheers,
Patrik
On Mon, Mar 24, 2014 at 3:22 PM, Akka Team <[email protected]> wrote:
> Hi Logan,
>
>
> I took a look into the akka-persistence documentation and from what I can
>> gather the goal of the project is to store processed messages so that an
>> actor's state can be rebuilt upon an actor's restart, while I'd like to
>> store unprocessed messages so they can be processed upon an actor's restart
>> (for my purposes, my actor is essentially stateless).
>>
>
> Processors (
> http://doc.akka.io/docs/akka/2.3.0/scala/persistence.html#Processors)
> store the message *first* and then process them. If you do not want to keep
> the whole history of the Processor in the journal you can delete messages:
> http://doc.akka.io/docs/akka/2.3.0/scala/persistence.html#Message_deletion
>
> -Endre
>
>
>>
>> Am I understanding this incorrectly? Is there a way to accomplish my goal
>> with the persistence module, or is there an alternative approach?
>>
>> 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 [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.
>>
>
>
>
> --
> Akka Team
> Typesafe - The software stack for applications that scale
> Blog: letitcrash.com
> Twitter: @akkateam
>
> --
> >>>>>>>>>> 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.
>
--
Patrik Nordwall
Typesafe <http://typesafe.com/> - Reactive apps on the JVM
Twitter: @patriknw
--
>>>>>>>>>> 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.