You are not logged in.
Pages: 1
Hello everyone, I would like an opinion from the community. I have the following architecture, a domain layer using interfaces with several hosted tenants using the mormot's ability to define multiple servers in a single connection. This layer is protected. And I have a public layer, also using interfaces, this layer is a client of the domain layer. However, I use a single TSQLHttpServer to communicate with all tenants in the domain layer. For this I use information contained in the jwt token. Well, everything works fine until I now need to work with callbacks. Does anyone have an idea of how to implement this type of architecture?
I cannot implement this in my domain layer because it is protected and not published. However, I need to distinguish between a callback and another in my public layer because it is a client of several mormot servers. I don't know if I explained it well, otherwise I can pass passages of codes to complement the explanation.
Offline
For callbacks, you will use a WebSockets connection.
You should enable the encryption at WebSockets layer.
Then, you authenticate the user as you want (e.g. JWT).
The callbacks will be available only on an already secured WebSockets connection, so no need to add another authentication level.
Offline
Hi ab, I don't know if I expressed myself well, I'll try to describe my architecture:
- (Server 1) I have a TSQLHttpServer that works as a gateway. This is working on port 8888 right.
- (Server 2) this server is a client of domain servers via interface. Then on another server I have the following architecture working on port 8889.:
TSQLHttpServer.Create(GetPort,[FServerTenent1,FServerTenent2,FServerTenent3,
FServerTenent4]);
So with each request that on server 1 I know which client to instantiate from server 2 because I receive information that distinguishes the servers in the jwt key.
Any and all requests are made by the user on server 1 and not on serverv 2.
Now I'm thinking how to implement a callback server on server 1 and I need to distinguish one client from another on server 2. If I go through a simple array of callbacks, all my connected tenants will receive responses, and this cannot happen. I must propagate messages differentiating one tenant from the other.
I thought about using a record array to control this. Or am I thinking too wrong about it?
Offline
How can I distinguish the correct callback in this case?
I created something like:
TCallbackConnection= packed record
UIDReg:Int64;
ListCallback:array of IInvokable;
end;
Do you think it would work to control callbacks for different tenants?
I pass this UID and the callback instantiates in my subscribe method.
Offline
Hi Ab, it is because my TSQLRestServer works as a gateway. is a TSQLRestServer for several TSQLRestServerDB on another server, and each TSQLRestServerDB is a tenant. I cannot answer calls to all tenants through a callback array. Senao will have a tenant receiving a response from another tenant. And that is not desirable in my architecture.
Offline
It is possible to ab. I see that my architecture may have a flaw. Let me see if I can explain it to you. My public server TSQLHttpServer has a TSQLRestServerFullMemory. He is a client of another protected Private server. which has another TSQLHttpServer with several TSQLRestServerDB (each one is a tenant). On this first server I have a route resolver. that connects me as a client on the second server in a desired tenant (TSQLRestServerDB). Confusing this architecture? I understood that callback responds to TSQLRestServer but my architecture is a little different. But I am subject to opinions.
Offline
Ok Ab, thanks for the clarification, I used a record array that contains a list of callbacks and their UIDs. It worked at first I still need to test in thread. Is this architecture that I put in place valid? Sometimes I think I could solve everything with a single server.
Offline
Yes Ab, but if I am going to answer every callback that is on the gateway server, it will send responses to tenants who do not expect this answer.
Offline
Oi @ mdbs99, the ideal would be to let the tenants' servers do this management. But callback listeners do not connect directly to these servers, they pass through the gateway. Only he knows which tenant server to request.
Offline
Pages: 1