Answer the question
In order to leave comments, you need to log in
How can such calculations be organized?
Greetings!
At the moment, I have implemented a program for calculating some values using formulas. Data is taken from three different sources: "Source 1", "Source 2" and "Source 3". At the checkout time, for example, at 15:00, we turn to the sources in turn, request data from them and start the calculation, after which the result is saved to the database.
There was a problem that at one source the data arrives with a delay of 2 hours, but the customer agreed that at 15:00 we would calculate the data at 13:00, but still the system does not work at 100% - always somewhere then yes, there are delays, you need to resume data, recalculate, etc.
The second version of the program was made, where I tried to implement the idea of "reactivity", something similar to Excel, i.e. when the data is loaded, then dependent on them should be recalculated. But the implementation didn't turn out very well...
Now I'm thinking of making a third implementation based on events, i.e. for example, we loaded data from the first source, then we publish the event "Data from the first source was loaded for the period [from ..., to ...]" to the bus, the handler receives it, makes a calculation and publishes a new event "Such and such a value was calculated ...", another handler receives it, does its calculations and publishes a new event, and so on.
Do you think the third option is viable?
Answer the question
In order to leave comments, you need to log in
it is also useful to familiarize yourself with default values
and the book "notes of the automator"
In banking software (and in any accounting software, perhaps) - a table is often made for the current balance in the database. Any posting, any document leads to the replenishment of this table. Of course, in the context of the specifics of the wiring, type of document, etc. That is, as a kind of meaningful intermediate result, thanks to which you can know the balances at any point in time. Not 100% sure this is exactly what you need, but think along these lines as similar questions have already been addressed by others.
Your last option is essentially the same reactive approach. Why didn't he suit you?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question