Replies: 3 comments
-
@fubz Have you checked out https://loopback.io/pages/en/lb4/readmes/loopback-next/examples/multi-tenancy/ for inspiration? |
Beta Was this translation helpful? Give feedback.
-
I did check out the multi-tenancy project. It looked promising at first however it looks like this isn't my use case. multi-tenancy in my understanding is having multiple users, having shared access to a singular database. I need to have 1 user, connect to 1 loopback, that updates and joins data to and from multiple - but same schema - databases. |
Beta Was this translation helpful? Give feedback.
-
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the |
Beta Was this translation helpful? Give feedback.
-
Hello all,
I have a particular use case that I am trying to solve and based on a conversation I had with @raymondfeng at IBM Think in 2019, Loopback 4 should have the features required to solve my problem case.
I have an application that is Active/Active in multiple data centers and I need my Loopback application to handle updating an Oracle database in both data centers as well as combining and deduplicating when requesting data from these multiple databases.
Let's go over some use cases:
User is updating a configuration that needs to be posted to and the same in both data centers. User fills out form, presses Save, data posts to Loopback. Loopback then needs to insert/update to both back end data sources.
User is viewing log data. User requests Log model from Loopback, pulls data from both data centers, performs a union (and possibly a deepEquals) and presents user with data from both data centers.
That should cover all my cases. When fetching data, if I always unionWith a deep equals, then I will be able to display config data without it being duplicated, as the configurations should be the same in both data centers. Then when the app is fetching data that is unique to the data center, such as a log, a union with a deep equals will combine the data into an aggregate view.
There are certainly the error cases, what happens when 1 data center is down? I imagined persisting the insert/update in another table which could then be acted upon when the downed data center returns.
I believe this topic aligns a little bit with the issue: Multi-tenancy and dynamic schema selection, in particular StackOverflow answer: How to attach a single model (e.g. Product) to multiple datasources (LB3)
I just recently started using Loopback 4, and recreated my app that existed as a Loopback 3 app, using the @loopback/rest-crud component. I was hoping to leverage some of the magic from the rest-crud project, but I suppose this might be a case where I need dig deeper into Loopback 4 features. But I figured I would start with the experts in case I am missing an obvious avenue to approach.
Beta Was this translation helpful? Give feedback.
All reactions