retrieve persistence message via seqNr?

30 views
Skip to first unread message

何品

unread,
May 13, 2014, 1:15:15 PM5/13/14
to akka...@googlegroups.com
Hi,currently there is no war to retrieve one specified message from the processor, the only way i think is using an hashmap to keep it on Recover right?

and the EP's persist(message ,callback) ,I think the callback should provide the persistence message's seqNr too,currently I need to use the lastSeqNr or getCurrentPersistenceMessage.seqNr to get It,I don't know is that right.but On my test ,the next persistence message will be lastSeqNr +1.

so If I can't retrieve message from the processor,so I need a db or somewhat right?and can only use the processor to store state, but not whole information?

Björn Antonsson

unread,
May 14, 2014, 6:29:27 AM5/14/14
to akka...@googlegroups.com
Hi,

I'm not sure that I understand what you are trying to achieve. The Persistent messages that you send to an Processor, or in the case of the EventsourcedProcessor the events it persists, are  meant for the Processor. The sequence numbering is internal to the Processor and used for recovery. Why would you want to get a specific message with a specific sequence number from the outside?

B/
--
>>>>>>>>>> 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.
-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

何品

unread,
May 14, 2014, 6:33:44 AM5/14/14
to akka...@googlegroups.com
yes.
I want some method like get(seqNr) to get an message ,could that be done?
now,I need to save them in a Map

在 2014年5月14日星期三UTC+8下午6时29分27秒,Björn Antonsson写道:

Björn Antonsson

unread,
May 14, 2014, 6:48:13 AM5/14/14
to akka...@googlegroups.com
You still haven't told me why you want that method, or which problem you are trying to solve.

B/

何品

unread,
May 14, 2014, 7:15:49 AM5/14/14
to akka...@googlegroups.com
I want an actor which represent an android phone connected via GPRS or WIFI,and I get it's IP address and then save it's GEO position via akka persistence.

and I want to provide a rest API to retrieve the position. I will notify other system an message with an persistence seqNr,and them can later using it to retrieve information anytime.

for the current API,I think I can only do this Via view or Processor ,and build a map or a list from the message right?

If I want to keep all my message in my map then many memory will be used ,If I don't then I will mismatch some key.

If I want to get an specified message ,how should I do?maybe my exposing of the SeqNr is not a good idea.



and ,another thinking is,If I have some operation need to be done,then I save an PendingEvent in EP,and split the work to work actor,and when the work done,
I delete the PendingEvent and save a new DoneEvent.

maybe I should not using it like a db.


在 2014年5月14日星期三UTC+8下午6时48分13秒,Björn Antonsson写道:

Björn Antonsson

unread,
May 14, 2014, 8:39:42 AM5/14/14
to akka...@googlegroups.com
Hi,

You are right that you shouldn't use the journal as a database. If you want to use event sourcing to model the changes on the client, then I would use a View to populate a query model (maybe in a SQL database) that fits your queries.

B/

何品

unread,
May 14, 2014, 8:51:29 AM5/14/14
to akka...@googlegroups.com
I think just cause some guys using leveldb as as some redis thing ,and akka persistence are using it default.

now I am going to store the information in some other place,redis for now.
thanks

在 2014年5月14日星期三UTC+8下午8时39分42秒,Björn Antonsson写道:
Reply all
Reply to author
Forward
0 new messages