Thanks Filippo. I think I figured out now what was going wrong.

I was confused between the shardId and the entityId.

shardId == context().parent().path().name()
entityId == self().parth().name()

My entities were being created again and again because I was computing the 
entityId wrongly. In my case, all messages carry an id. What I need is 
entityId = hash(messageId) and shardId = hash(entityId). However, I was 
doing entityId = messageId and shardId = hash(messageId). Therefore I was 
always creating a new entity because the messageId is unique. I've fixed my 
MessageExtractor now and everything goes as it should.

thanks,

Bert

On Thursday, February 11, 2016 at 5:36:17 PM UTC+1, Bert Robben wrote:
>
> Hi,
>
> I'm trying to use sharding and that works reasonably well (my entities are 
> being created across my cluster and they respond to my requests).
>
> However, I notice that after each call to my entity, it is destroyed. 
> Every next call on the entity then recreates it. This is not ideal for me 
> since restarting my entity is a heavy process (I might need to recover lots 
> of state from the database). So I would like to tune the system such that 
> my entities are survive for much longer (they are perfectly suited to 
> handle many concurrent requests). Is this somehow possible with the current 
> implementation?
>
> Note that I use state-store-mode = ddata and I don't make use of Akka 
> Persistence.
>
>
> Also, in my case it is vital for my entity to know its id, because that's 
> how it discerns itself from the other entities. The only way I've found to 
> get to the id now is to do context().parent().path().name(). That works, 
> but feels very implementation dependent. Am I missing some easier API?
>
>
> thanks,
>
> Bert
>

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to