IRODispatchNotifier
Overview
The IRODispatchNotifier interface provides methods for receiving notifications when a service methods are about to be invoked. In Remoting SDK, this interface is used by TROInvoker to notify services about incoming requests before their methods are actually invoked.
IRODispatchNotifier is implemented by the TRORemoteDataModule, which fires an OnGetDispatchInfo
event whenever it receives notifications.
Use Case
If you use TRORemotable as your base class, you can implement this interface in your service class to obtain access to specific information (like MessageName
from IROMessage, which stores names of called methods). For example, by default, TRORemotable does not provide access to ClientID
, but you can still obtain it, as shown below:
TNewService = class(TRORemotable, INewService, IRODispatchNotifier)
private
FClientId: TGUID;
procedure GetDispatchInfo(const aTransport : IROTransport; const aMessage : IROMessage);
protected
function ShowClientId: Guid;
end;
procedure TNewService.GetDispatchInfo(const aTransport: IROTransport;
const aMessage: IROMessage);
begin
FClientId := aMessage.ClientID;
end;
function TNewService.ShowClientId: Guid;
begin
Result := GUIDToString(FClientId);
end;
The demo DispatchNotifier is a good example of how to intercept method calls and get other information about the client.
Location
- Unit: uROServerIntf.pas
- Ancestry: IRODispatchNotifier
Required Methods
GetDispatchInfo
Allows to grab the input parameters to get all information about the upcoming call including the remote method parameters and the calling client transport object.
procedure GetDispatchInfo(const aTransport: IROTransport; const aMessage: IROMessage)
Parameters:
- aTransport: Points to the transport object containing connection-specific information
- aMessage: Message that needs to be processed