-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support database isolated multi-tenancy #699
Comments
Hello, I am not sure what kind of multi-tenant architecture is used in your project. In our practice, the tenant id is stored in the message header, and then the consumer retrieves it from the header. You can think that message-based and HTTP-based(request-response) have familiar processing methods. Let me know what you think? |
Hello yang-xiaodong, I sending event for calculation and after whole calculation done i gonna process calculation result, I don't know is it right way but i thinking to follow Received table to event is |
I got it, it seems that querying by tenant-id in json is indeed not a good idea, we will consider support for multi-tenancy. At present, I think you can create a mapping table, map the Id of the Received table to the tenant Id, and then use the sql join query to get the data you want. You can get Received table Id using the following code: [CapSubscribe("xxxxx")]
public void Subscriber2(Person p, [FromCap]CapHeader header)
{
// received table id
var id = header[Headers.MessageId];
} |
Hi @yang-xiaodong , |
Hello @ztzsws1 , The currently architecture unable to support a multi-tenant system with database isolation. If you have any ideas, please feel free to drop them here |
I think it's possible to store the identity of a tenant in Message.Headers and use static fields to allow users to change the identity name of a tenant |
I think static fields, not the correct way. Bcz with every message delivery with the different tenants. I actually taking tenant info from the user credential. Better to run out from authentication to message header. |
With our previous messaging solution we attach tennant info to each outgoing message, and then on the reciever side, we have a pipeline before the message end up in the recever function, where we take the tennant info from the message and create a new scope (using (var scope = _serviceProvider.CreateScope()){}) get a scoped tennant info class from the DI container, set tennant info to the class, and then call the reciever function.. Then in the reciever function, and everywhere in the scope of this message we have an injectable tennant info class... Would something like that be possible? |
The article "Using CAP library in a multi-tenant application via SubscribeFilter" may give an idea about multitenancy |
Perhaps this project is a solution: https://github.com/netcorepal/netcorepal-cloud-framework/tree/main/src/Context.CAP |
Hi,
When using microservice architecture, event process at the same time with different tenant, may better to archive this information on the header and using multi-tenancy database architecture.
Is it possible to open a new branch for this feature?
The text was updated successfully, but these errors were encountered: