Load aggreagate in a specified version

85 views
Skip to first unread message

Kamil Essekkat

unread,
Oct 23, 2015, 5:15:43 PM10/23/15
to Axon Framework Users
Hi,
Is it possible to load an aggregate as of given version (read only)?
I'd like to do something like Repository.load(id, version) but get an aggregate instead of Exception.

If not, how would you load a historic version of an aggregate?

Regards, Kamil

Allard Buijze

unread,
Oct 28, 2015, 3:53:28 PM10/28/15
to Axon Framework Users
Hi Kamil,

What do you need the historic version for?
If you really need it, you'll have to construct an instance yourself using a DomainEventStream. Stop streaming event when the desired timestamp/event is reached.

Cheers,

Allard
--
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.

Kamil Essekkat

unread,
Oct 29, 2015, 6:56:57 AM10/29/15
to Axon Framework Users
Hi Allard,
I need it for something like showing purchase history with past prices and so on.
So one option is specialization of an EventSourcingRepository. I guess the other would be creating dedicated read model.
Do you then recommend option 1?

Allard Buijze

unread,
Oct 29, 2015, 7:01:45 AM10/29/15
to Axon Framework Users
"showing purchase history"... sounds like a query to me.
My recommended option is to use a query model for queries

Cheers,

Allard
Reply all
Reply to author
Forward
0 new messages