routing - Creating actor per domain object -


i have been trying use router consistenthashingpool create actors on fly consume messages on basis of object id, in simple case unique string.

i want actor per domain aggregate , seemed simple way of doing it.

but hashing seems doing odd things , sending messages actors have been spawned different hash mapping value.

actorsystem.actorof(     props.create(() => new myaggergateactor()).withrouter(         new consistenthashingpool(10)         .withhashmapping(o => (o myevent)?.myaggregateuniqueid ?? string.empty)         .withresizer(new defaultresizer(1, int.maxvalue))),      "myaggregaterouter"); 

also tweaking values nrofinstances seems break things well, meaning hash maybe works across set of initial instances , no new actors being spawned? thought resizer supposed me here?

please forgive naivety, have started using akka.

the key here understand routers do. consistent hashing means, given range of possible consistent hash values, each of actors in router's pool responsible handling range of hashes total range of possibilities.

for example: if consistent hash can 1 of values possible range of 1-100, consistent hashing router pool of 10 actors, delegate messages hashes 1-10 first actor, 11-20 second one, , on... once you'll resize pool, hash ranges re-adjusted each actor in pool - in case after resizing pool 20 actors, first 1 serve ranges 1-5, second 6-10 etc.

if want create actors on fly , route messages them based on entity id, believe thing, you're looking akka.cluster.sharding.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -