Upcasters: is in-place update OK?

177 views
Skip to first unread message

Gian Luca Ortelli

unread,
Nov 19, 2015, 3:14:10 AM11/19/15
to Axon Framework Users
Hi,

I'm writing an event upcaster for an Axon 2 application. The events are stored in XML, and therefore I upcast by manipulating Document instances, just like the example in the guide (http://www.axonframework.org/docs/2.4/repositories-and-event-stores.html#event-upcasting).

I have doubts about the style of the DOM manipulation: the upcaster in the example creates the upcasted event as a modified copy of the old event; does this mean that in-place update is discouraged or wrong?

Kind regards,
  Gianluca Ortelli

Allard Buijze

unread,
Nov 19, 2015, 3:30:55 AM11/19/15
to Axon Framework Users
Hi Gianluca,

It's been a while since that example was written, but if I recall correctly, the copying is necessary because you can't just move en element to another location. That's a Dom4J restriction. Therefore, a copy of an element is attached to its new location.

It's fine to simply change the intermediate representation in-place. There is no need to treat them as immutable objects.

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.

Gian Luca Ortelli

unread,
Nov 19, 2015, 4:21:36 AM11/19/15
to Axon Framework Users
Thanks Allard,

good to know. That will avoid a lot of noise in the code.

Cheers,
  Gianluca
Reply all
Reply to author
Forward
0 new messages