Wednesday, February 27, 2019

Data Modeling With Indexes: Event Sourcing (Part 3): Time-Sensitive Data

I got a great comment on my previous post about using Map/Reduce indexes in RavenDB for event sourcing. The question was how to handle time-sensitive events or ordered events in this manner. The simple answer is that you can’t; RavenDB intentionally doesn’t expose anything about the ordering of the documents to the index. In fact, given the distributed nature of RavenDB, even the notion of ordering documents by time become really hard.

But before we close the question as “cannot do that by design," let’s see why we want to do something like that. Sometimes, this really is just the developer wanting to do things in the way they are used to and there is no need for actually enforcing the ordering of documents. But in other cases, you want to do this because there is a business meaning behind these events. In those cases, however, you need to handle several things that are a lot more complex than they appear. Because you may be informed of an event long after that actually happened and you need to handle that.



from DZone.com Feed https://ift.tt/2TgNVdl

No comments:

Post a Comment