Today is Saturday and is sunny, which technically(and emotionally) means a beer day :) However, I’m in a mood for some ciders. I know, I know. But its a good idea to change up a bit you know ;) But before any of that, lets dive into some updates to Unbeered!

Code for this post is in branch: learning-unbeered-12.

  • Added two new collections to our DataStore - to start storing data when - HadTooManyBeersNotification and HadBeersConsecutivelyNotification events occur. The idea here is that if we can store these occurrences into their own collection, we can quickly query them for reporting without having to run any queries against the main entry collection.
  • Handler for HadTooManyBeersNotification is straight forward, as it just inserts a new record to the collection every time the event occurs.
  • For the HadBeersConsecutivelyNotification though, we need to insert or update since a running streak of continuously having beer might keep on going for a while! It could be “one long streak” or few “shot streaks” :) We’d also want to store when the streak began and ended.
  • Also changed Program.cs where now we get to see total beers since the beginning, total number of when consumed too many beers, and finally total number of consecutive beering including when it began and ended :)

Whats next?

This was pretty fun actually. I can start to see the power of event based style of the application! Before we add in any more features, I think we should clean up/ re-arrange some code and start thinking of using permanent data store, as in not having to delete existing data and start all over again!

Ciders here I come. Until next time!