akka persistence query and event tagging

352 views
Skip to first unread message

code....@gmail.com

unread,
May 24, 2016, 1:35:21 PM5/24/16
to Akka User List
Hi all,

I think the most convenient way consuming of persisted events is using eventsByTag, so I have a dilemma of tagging events, for example I see two options:

1. by bounded context (like inventory, customer etc)
2. by account id

In the second case you can expect a lot of consumers, let's say 500 000, so I have some concerns about scalability..., do you see any problems with this approach specifically with cassandra or it's better use as less consumers as possible and then delegate replaying work to other code?

Thanks.

Filippo De Luca

unread,
May 24, 2016, 1:54:19 PM5/24/16
to akka...@googlegroups.com
Hi,
I am using both, as in cassandra plugin you can have 3 tags for each events. While the tag at position 2 and 3 should be known in advance, the first tag is free. So I am using to tag the event with a particular Id that make sense to my domain.

To be fair in the first tag I also put some bounded context as well. I have found this approach quite useful.

cheers

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



--

Olger Warnier

unread,
May 24, 2016, 1:59:27 PM5/24/16
to Akka User List
I'd suggest to use tags per aggregate root and have the account id as the persistenceId. 
when you use cluster sharding, that gives a great option to 'instantiate' a specific instance of the aggregate root and for the query side you use the tags.. works quite well in practice. 

kind regards, 

Olger

code....@gmail.com

unread,
May 24, 2016, 2:37:22 PM5/24/16
to Akka User List
yep multiple tags could be a good option, as it can give me more freedom in the future if I decide to change replay logic.

Olger, regarding your solution, for example if we take customer aggregate root, tag should be "customer" and persistenceId should be something like "account_123_customer_456" ?

Olger Warnier

unread,
May 24, 2016, 3:44:47 PM5/24/16
to Akka User List
Without knowledge of your domain, the tag would be something like "Customer" and the ID would be customer_456 (or a UUID) 
any reason you like to attach the account_123 upfront ? Looks like some kind of relation between account and customer. 

code....@gmail.com

unread,
May 24, 2016, 4:31:29 PM5/24/16
to Akka User List
well, no reason..., I just did not follow your comment "... have the account id as the persistenceId."





On Tuesday, May 24, 2016 at 8:35:21 PM UTC+3, code....@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages