-
Notifications
You must be signed in to change notification settings - Fork 14
Rpc server programming
- Public API
-
RpcServer- Single entry point for server side stack. -
RpcServerConfiguration- Configuration API to tweak client side behavior.
-
- Extension API/SPI
DispatcherServiceTypeLocatorServerTransportManagerServerTransportServerRequestContextServerResponseContext
There are APIs which are used by applications.
RpcServer is entry point for the server. You can start server side listening with Start() and finish with Stop() or Dispose().
RpcServerConfiguration represents configuration settings, that is this is Configuration API.
If your application requires file based configuration, build RpcServerConfiguration using your configuration settings (such as custom ConfigurationSection).
You can also set providers for custom Dispatcher, ServiceTypeLocator, and ServerTransportManager on the configuration.
If you want to customize RPC, you can use following APIs (and/or SPIs).
Dispatcher dispatches messages to appropriate service methods and handle thrown exception to rpc error.
There is a default dispatcher called LocatorBasedDispatcher which delegates target method locating to a ServiceTypeLocator.
ServiceTypeLocator locates service types and its methods in specific way.
There is a default locator called DefaultServiceTypeLocator and FileBasedServiceTypeLocator. For more information, see Locating RPC Services
ServerTransportManager manages ServerTransport lifetime. For connection oriented protocol, it handles asynchronous accept operation.
Implement it if you want to implement custom transport such as additional transport protocol support. You also must implement own ServerTransport.
ServerTransport represents transport session between client and server on client side. The base class implements following:
- Serialization/deserialization.
- Invalid (corrupt) request handling.
- Method dispatch (Dispatcher invocation).
- Exception translation.
Implement it if you want to implement custom transport such as additional transport protocol support. You also must implement own ServerTransportManager.
ServerRequestContext and ServerResponseContext encapselates context information of communication.
Modifying from custom transports or filters is not supported.
Custom transports use its internal data via SocketContext property which returns SocketAsyncEventArgs.