On Fri, May 29, 2015 at 12:48 PM, Sławomir Nowak <slnow...@gmail.com> wrote:
I'm not sure whether I should ask this question here, since it's more like a design question than framework one. But I'm using axon framework to implement this, so maybe let's try... ;)--Imagine the following:You have an Event. This is the main concept of your application, it acts like a state machine.It could be in a PROPOSED state - in that case, people should be able to vote for and against it (for example: AxonFramework Workshop - as an end user I would like to say whether I would participate in this workshop or not (voting up/down)).So surely there is a concept called "InterestSurvey".Now, besides of voting, as a person which organizes this event, I would like my potential participants to answer few questions - for example "What's your Java skill?".In my domain, currently I call it "Questionnaire". Questionnaire is something optional.Now:These concepts are clearly related to Event. But on the other hand, since Event is my main aggregate, also acting as a state machine, I consider putting InterestSurvey and Questionnaire inside Event as a bad idea. So I'm about to implement them as a seperate AggregateRoots.And the problem:What is responsible for starting and ending Survey and Questionnaire?1) At the beginning I thought maybe Event should act as factory for those two.Something like:
final Survey survet = event.startSurvey(...)
final Questionnaire = event.startQuestionnaire(...)
event.stopSurveying()those methods also should change event's state.But it causes few problems. My CommandHandler needs to know about 3 repositories - for Event, Survey and Questionnaire. As far as I know, it is impossible to test it with
GiventWhenThenFixture
as it references more than one aggregate root at the time.2) What about a domain service?I could create a DomainService which:- changes Event's states- creates both aggregates- ends them when needed.I don't like this idea mainly because I'm moving event's behaviour somewhere else. There's another problem - AFAIK axon repositories don't allow you to query by something else than aggregate ID. So how should I reference Survey and Questionnaire, having only EventId at the time?Anny suggestions?
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.