Event-driven
In Cloudia platform, you can make the system respond to a range of important events. An event is assigned a chunk of code, which is performed as soon as the event happens. Typical examples of such events are the situation immediately before or after creating, updating or deleting a record, the request to view record details etc. Individual code chunks are always defined for a certain type of record, not for individual ones; records of the same type are supposed to act in the same way.
Use case: article view counter
To activate a simple counter of article views, it is enough to have a small chunk of the code which gets called every time a detailed view of the article in question is requested. In this case, a simple counter of the selected article parameter is incremented. In reality, it would be probably desirable to attempt to determine the number of unique “readers”, for example by monitoring IP addresses, which are already counted in as “readers”.
Use case: Monitoring of products in stock
If we desire to monitor the amount of products in stock in an e-shop, we simply provide a product with the parameter of “quantity in stock”. Next, we create an event determining that adding, editing or deleting the record of the “order contains a product” type has to adjust the amount of goods in stock accordingly. This will ensure that the amount of the product in stock plus its amount in orders will always be equal to the initial amount in stock. In practice, different phases of order (confirmation, dispatch) will be taken into account and stock data will be altered accordingly.
