I would like to ask for some help with deciding on what kind of message, what they should include, and how long they should be. It is sort of about message decomposition.
I am trying to build a case for separating/relaxing a reporting sql db from the production in a retail environment.
The case is about a client’s receipt being registered and based on many of those registered receipts a report is made every day about how many new customers, as well as if it were purchased from a store or online, and which articles were purchased.
Once every X minutes we get a list of multiple receipts (can be 1 or can be 100s), so I have a list of incoming receipts with all the data (where, who, how many, total sum, etc as one would see when you purchase something)
As a step 1 I would like to inform the reporting service about the following:
- we have a new purcahse from store/online
- if it is from a new customer or existing/member
- there have been bought 1 x ArticleA, 3 x ArticleB, 2 x ArticleC
- the total sum of each the receipt
While it is easy to send an event/messages like:
- new purchase from an existing member
- purchase total sum
- a new customer registered
I am not sure if they should be like that or they could be combined messages so that the reporting service could create several records from one message (so that the reporting service could create several records from one message), for example:
- new purchase from an existing member for a total sum of X
- new purchase from a new member for a total sum of X
then as about the articles and amounts, should it be:
- an ArticleId X purchased
- an amount of N of ArticleIDs X purchased (could be from a single purchase or a result from multiple receipts coming every X minutes)
the thing about articles is that sometimes the list is going to be quite big for a message (let’s say you buy groceries for one week, then there could be a 100 or ArticleIds in the message). So, while I have some options about new/old customers’ messages or total sums, I do not know how to deal with the lists of purchased ArticleIds that need to be sent to the reporting service. It does not feel right to send long lists and at the same time, it does not feel right either to send 100 messages for each Article(Id) that was purchased, or is it OK to do that?
Any thoughts on that?