-1

I'm implementing CQRS pattern with Event sourcing, I'm using NServiceBus, NEventStore and NES(Connects between NSB and NEventStore).

My application will check a web service regularly for a file to be downloaded and processed. The file will be then de-serialized into objects (let's call them Orders), and each Order should be processed separately and independently. Now inside the (File domain) I'm creating an event for each Order called (OrderExtracted), and calling Apply to raise that event.

What I noticed is that by default, the column size in NEventStore that hold the number of events (Items) is tiny-int, However in my case, sometimes there are files that contains 1000+ orders ! Does it mean that an event source should not normally have more than 255 events?

Do I need to change my design?

Nour
  • 5,252
  • 3
  • 41
  • 66
  • Tinyint denotes the number of events in one commit, not one stream. On average there will only be 1 event per commit. – Yves Reynhout Mar 03 '14 at 22:28
  • So if my event source applies 5000 events in one commit, does it mean there is something wrong in my design? – Nour Mar 05 '14 at 06:19
  • Yes. It's a bit beyong the scope of this medium to get into the details but you can always contact me (http://bittacklr.be) – Yves Reynhout Mar 05 '14 at 12:43

1 Answers1

1

Does it mean that an event source should not normally have more than 255 events

Definitely not, there is (technically) no restriction on how many events a stream can have. Generally, when your streams begin to get large you would introduce snapshots to avoid having to load the entire stream over and over.

Do I need to change my design

I haven't worked with NEventStore, however, it would seem strange to me if tinyint was the suggested default value for this. Regardless, if it is and it doesn't work for you then change it...

James
  • 80,725
  • 18
  • 167
  • 237
  • Thanks James, Your answer is helpful, However, when I suspected that I need to change the design, it is not just because of the NEventStore column size limitation, but also that I felt it maybe can be modeled in different and easier approach. – Nour Feb 24 '14 at 09:52
  • @NourSabouny well you haven't mentioned any reasons *why* you feel it could be modelled better nor suggested your potential approach so I can only answer the question as it's asked. – James Feb 24 '14 at 10:01