List all snapshots of a certain Akka.Net actor in a Web UI - akka.net

I need help trying to figure out Akka.Net for a Event-Source PoC that I am building.
Say I have an Order Entry system, in which the Orders are modelled as ReceivePersistentActor. I have figured out the process of sending Commands to the Order IActorRef, such that it persists relevant events, and updates the order state accordingly. I can see Journal entries and Snapshots (one snapshot for each order) being written to the backend SQL database. So far so good for the Command side of CQRS. It is on the Query side that I am struggling to apply what I am seeing in the Akka.Net documentation.
On the Query side, I want to have a view that:
lists all the orders, by reading all the existing snapshots for the
Orders when the page loads, and,
then have the view auto-update
based on any changes that happen to the Orders.
It seems that Akk.Net Streams is the way to go here on the UI side. But I cannot figure out what query to run to get that initial list of all orders.
Any advice in this regard will be much appreciated please. How do that get that initial list of all orders as per their latest snapshot state?

Related

YouTrack - Historical issue snapshots

The new YouTrack API is missing the old Issue history /rest/issue/{issue}/history end-point which our code heavily depends on. There's only the Issue activities /api/issues/{issueID}/activities end-point, which returns only delta differences between changes from this never-ending list of diff/activity categories.
Is there some simple way to get a list of issue's historical snapshots, or do I actually have to parse all these activity categories and somehow merge them together to (re)implement this whole thing by myself?
The /history endpoint didn't provide a history snapshot either, but /activity does output much more data indeed. Yet, that's the way to do it — traverse through data and build a snapshot based on the provided timestamps.

Dashboard that updates real time, how to structure

I am trying to create a dashboard app for my company that displays data from a few different sources that they use. I am starting with an in house system that stores data in MSSQL. I'm struggling to decide how I can display real time (or at least updated regularly) data based on this database.
I was thinking of writing a node server to poll the company database and check for updates and then store a copy of the relevant tables in my own database. Then creating another node server that computes metrics (average delivery time, Turnover, etc.) from my database and then a frontend (probably react) to display these metrics nicely and trigger the logic in the backend whenever the page is loaded by a user.
This is my first project so just need some guidance on whether this is the right way to go about this or if I'm over complicating it.
Thanks
One of solutions is to implement a CRON job in nodejs or in you frontEnd side, then you can retrieve new Data inserted to your Database.
You can reffer to this link for more information about the CROB job :
https://www.npmjs.com/package/cron
if you are using MySQL, you can use the mysql-events listner, it is a MySQL database and runs callbacks on matched events.
https://www.npmjs.com/package/mysql-events

SQL Database Tracking Method

I am building a database in SQL developer and am trying to figure out how to integrate tracking customer orders in my database. It would only need to know where the order is at any time during shipping. Any ideas? I am looking for the very basic way for it is only for a class.
At a high level, you will need to represent the customer and the order. In most cases, orders have line items.
To track where the order is in the process, the simplest way to do that is to have a stat field. The status is changed over time. One step better would be to track the changes of the status in a OrderStatusHistory or something of that sort.
Here is a sample ERD without any fluff:

How to store complex records for referencing historical revisions?

I have a table on my database that outlines complex processes in a work breakdown structure (similar to what's used to create Gantt charts). There are multiple rows for a particular process, each row outlining a hierarchical step of a particular process.
I then have a table with some product types, each being linked to a particular process. When an order for a particular product is placed - it is to be manufactured with the associated process.
In my situation, the processes can be dynamic (steps added or removed, for example).
I'm curious as to what the best way to capture current and historical revisions of each process is, such that even though a process may have evolved over time - I can historically go back to a particular order and determine what the process looked like at that time.
I'm sure there are multiple ways to go about this, using logging or triggers with a new history table - but I've had no experience doing something like this and I'd like to know what worked well for others.

Web Leaderboard

I'm implementing a Leaderboard into my django web app and don't know the best way to do it. Currently, I'm just using SQL to order my users and, from that, make a Leaderboard, however, this creates two main problems:
Performance is shocking. I've only tried scaling it to a few hundred users but I can tell calculating ranking is slow and excessive caching is annoying since I need users to see their ranking after they are added to the Leaderboard.
It's near-impossible to tell a user what position they are without performing the whole Leaderboard calculation again.
I haven't deployed but I estimate about 5% updates to Leaderboard vs 95% reading (probably more, actually) the Leaderboard. So my latest idea is to calculate a Leaderboard again each time a user is added, with a position field I can easily sort by, and no need to re-calculate to display a user's ranking.
However, could this be a problem if multiple users are committing at the same time, will locking be enough or will rankings stuff up? Additionally, I plan to put this on a separate database solely for these leaderboards, which is the best? I hear good things about redis...
Any better ways to solve this problem? (anyone know how SO makes their leaderboards?)
I've written a number of leaderboards libraries that would help you out there. The one that would be of immediate use is python-leaderboard, which is based on the reference implementation leaderboard ruby gem. Using Redis sorted sets, your leaderboard will be ranked in real-time and there is a specific section on the leaderboard page with respect to performance metrics for inserting a large number of members in a leaderboard at once. You can expect to rank 1 million members in around 30 seconds if you're pipelining writes.
If you're worried about the data changing too often in real-time, you could operate Redis in a master-slave configuration and have the leaderboards pull data from the slave, which would only poll periodically from the master.
Hope this helps!
You will appreciate the concept of sorted sets in Redis.
Don't miss the paragraph which describes your problem :D
Make a table that stores user id and user score. Just pull the leader board using
ORDER BY user_score DESC
and join the Main table for the User name or whatever else you need.
Unless the total number of tests is a variable in your equation, the calculation from your ranking system should stay the same for each user so just update individual entries.