Client
The gRPC-based gateway for backend services such as CommandService
, QueryService
, or SubscriptionService
.
A connection can be established via host/port combination, or via already available ManagedChannel.
Multitenant applications need to specify TenantId for a new client connection. Single-tenant applications do nothing about it.
Client requests can be created on behalf of a guest user, if the user is not yet authenticated, and on behalf of the current user after the user is authenticated.
Please note that Spine client-side library does not define the authentication process. The Client
class simply relies on the fact that UserId passed to the method onBehalfOf represents a valid logged-in user, ID of whom the client application got (presumably as field of a UserLoggedIn
event) following due authentication process. The server-side code also needs to make sure that the UserId matches security constraints of the backend services. Security arrangements is not a part of the Spine client-side library either.
Subscriptions to entity states or events must be cancelled when no longer needed to preserve both client-side and backend resources.
The client connection must be closed when the application finishes its work.