How to make multiple streams for artists I'm following? - soundcloud

How to make multiple streams for artists I'm following ?
Example:
Put artistA, artistB in streamX
Put artistC, artistD in streamY

Related

Should I use one projection per entity or category?

I am coding a new application usign CQRS+ES architecture with Event Store DB. In my app, I have the following streams:
user-1
user-2
user-3
...
Each stream contains all events regarding a given user.
I am now creating a projection called user-account, which consists in basic data regarding my user's account (like first name, email, and others)
What is the optimal way to design that projection?
I should have a single projection for each user, creating projections called:
user-account-1
user-account-2
user-account-3
...
Or a single projection for all user-accounts? Being it a key-value pair record (that may store millions of keys in the future)
You can go with one stream per user. Projections are like dimensions. A user can exist in different "dimensions" (CDC naming) and have a different shape in each.
Read https://www.eventstore.com/blog/the-cost-of-creating-a-stream
First, subscribing to individual streams (aggregate or entity streams) won't ever work. You will end up with thousands of subscriptions, which are sitting there doing nothing (how often the user details change?).
The category stream is one way to go, you will project all the events for all the users. Not only you need just one subscription for all your users, but you'll also have more interesting possibilities like "users pending activation" or "blocked users" projections.
I prefer subscribing to $all and apply server-side filtering if necessary. It might have a bit of overhead as you receive more events than you need, but you get so much more power by combining events from different aggregates.
I wrote a little about it in Eventuous documentation.

Update two different tables with a single HTTP request

I want to write a http POST/PUT request that would need to update two fields in two different tables.
For example, I want to write a http request that would reset the marks obtained by a student in various exams like math, science, literature with each record being in different tables.
Is it a good practise to write a single post/put request that would do updates in different tables, although it's theoretically possible?
I'm writing the api in Flask.
Is it a good practise to write a single post/put request that would do updates in different tables, although it's theoretically possible?
That's a perfectly normal thing to do.
There are no constraints that require a one to one correspondence between your resource model and your data model.

What is the best practice to get data from two different http end points?

I want to fetch a list of Posts and display them in a ListView, each element of this ListView contains a title,body, and the userImage.
these data will comes from two different end points from the well known jsonplaceholder https://jsonplaceholder.typicode.com/posts and https://jsonplaceholder.typicode.com/users
I have already made the Post and the User models. should I create another PostWithUser model? or what?
so what is the efficient way to combine these two http requests?
Sorry for my bad English.
You can try with Future.wait. refer the following documentation
https://api.dart.dev/stable/2.5.0/dart-async/Future/wait.html
Eg.
Future.wait([apiCall1(), apiCall2()])

ReST API for replacing multiple resources for PUT

A good practice to name a PUT request is like:
/employee/123
What if I want to replace several employees? Is it a good practice to do so in single request? If yes, then how to name the url with multiple ids?
yes, you can remove multiple employs using a single URL
you can pass multiple ids like this
/employee=[id1,id2]

Filters in Spring Data Neo4j 4

I am trying to use Neo4jOperations in Spring Data Neo4j 4.
Filters can be used in Neo4jOperations for retrieving data from NodeEntity.
Eg. I have a case where there are actors with "roles" in a movie. Now,Actor and Movie is a NodeEntity and roles is a RelationshipEntity. If i query a movie for a title using Filters, it does show me the relevant details.
I want to query details in the form - "Find me actors who have relationship (any relationship) in Movie 'Cloud Atlas'." I am not able to find a way to work for this using Filters.
Filters let you specify something like key-value pairs. Can I specify key value as "roles.movies.title" and query for the results?
Tried it this way, it does not work out.
Do not want to use Custom Query as we want to keep the query generic so that it can accomodate a lot of use cases. Attaching a custom query will mean that it can address only a specific case.
It is possible to implement your own FilterFunction, however, much simpler is to use a custom query for this. Example:
#Query("MATCH (a:Actor)-[]-(n:Movie {name: "Cloud Atlas"}) return n")
public List<Actor> findActorsRelatedToCloudAtlas()