Serialization / ES integration re type names #2
Description
I want to build a service that has mutiple aggregates and build appropriate routing and/or splitting of processing into approriately separate agents using NES. While I could use the NES bucket
to keep all the events for a given aggregate together and then have several indendent projections per bucket/aggregate, I believe that NES' checkpoint/token mechanism for building a projection is generally intended to operate across aggregates within a BC. (EDIT Confirmed in https://jabbr.net/#/rooms/DDD-CQRS-ES at https://jabbr.net/#/rooms/DDD-CQRS-ES 14:00 UTC on 2014-8-8)
(ASIDE: I will log a separate issue and/or stand up a PR which addesses the need for the code to be work with >1 DU/Aggregate -- i.e. at present there are explicit references to Game in Serialization?)
Context: json.net v6 DU support - http://james.newtonking.com/archive/2014/02/01/json-net-6-0-release-1-%E2%80%93-jsonpath-and-f-support
At present (assuming I read the code right), you
- take the DU and are makign sure not to redundantly store the Case Name in the serialized body
- are only storing the Case name in the ES type field
For the same kind of reasons that we arrived at the resolution that it is correct to redundantly maintain a GameId
within an Event in order to allow contextless processing and/or restreaming of events, I believe it would be more correct to:
- store the full type name e.g.
Namespace.Module.Events.DU+Case
or similar as the EStype
of the message - Make the serialization stuff work more with the type name and/or lean on the V6 features/capabilities vs dealing explicitly in Case Names as aprt of the serialization code.
Whether it is easy to get json.net and/or Serlalizer
to instead of:
//{
// "Case": "Rectangle",
// "Fields": [
// 1.3,
// 10.0
// ]
// }
yield/store:
// [
// 1.3,
// 10.0
// ]
and then use the ES type
to guide the deserialization appropaitely is another matter.
Questions:
- do you agree that the
type
should be more than the just the case - do you look at each aggregate as being independent from a projection POV (i.e. to you have a clear picture I'm just not aware of re e.g. having a 1 agg : 1 "Handler agent" : n "Projection agent"s in a system) ? (I guess I could divine that from the code)
- would you be concerned with changing the code to use json.net native serializaiton and let it redundantly store the case (i.e. esp given 1. will already know the case) (Or can you see a quick way to resolve that?
I realize this is a wall of text but wanted to get my thoughs straightened out, Perhaps we need a https://jabbr.net/#/rooms/Fester to discuss Functional Event Sourcing [TERing] stuff like this in a more interactive manner :D