TROAsyncRequest

Overview

TROAsyncRequest objects present an ongoing or completed asynchronous request that is executing after one of the BeginMethod messages is set to an TROAsyncProxyEx. AsyncRequest can be used to check the status of the request, assign a callback or cancel request. It also needs to be referenced when sending the EndMethod message to receive any result or outgoing parameters, after the request has completed.

procedure TClientForm.Callback_GetPhotosList(const aRequest: IROAsyncRequest);
var
  lPhotoList: PhotoArray;
begin
    if not aRequest.Cancelled then lPhotoList := fService.EndGetPhotosList(aRequest);
    //...
end;

  fService := CoPhotoServerService_AsyncEx.Create(ROMessage,ROChannel);
  fGetPhotoListTask := GetService.BeginGetPhotosList(Callback_GetPhotosList);

Location

Implements

 

constructor Create

Creates a new instance.

constructor Create(aMessage: IROMessage; aChannel: IROTransportChannel; aCallback: TROAsyncCallback)

Parameters:

  • aMessage: Message
  • aChannel: Channel
  • aCallback: Callback method

AsyncException

This property stores the exception instance from the last run of the asynchronous request

property AsyncException: Exception read write

Callback

Callback nethod

property Callback: TROAsyncCallback read write
delegate: procedure Callback(const aRequest: IROAsyncRequest)

Cancel

Aborts the currently running request.

procedure Cancel

Cancelled

Boolean property shows was asynchonous request canceled or not.

property Cancelled: Boolean read write

Channel

The client channel that the request is being executed for. Read-only and mainly for reference and internal use.

property Channel: IROTransportChannel read write

DoCancel  protected virtual

procedure DoCancel

Done

Indicates that request was finished

property Done: Boolean read write

DoReadResponse  protected virtual

procedure DoReadResponse

GetCancelled  protected virtual

function GetCancelled: Boolean

GetDone  protected virtual

function GetDone: Boolean

Message

Represents reference to request message

property Message: IROMessage read write

NewInstance  override    (declared in TROInterfacedObject)

Creates and returns a new instance of the interfaced object, initializing its reference counter with 1.

class function NewInstance: TObject

ReadResponse

Reads response. Used in End* methods.

procedure ReadResponse

RefCount    (declared in TROInterfacedObject)

Provides read-only access to the reference counter. When this value reaches zero, the object is freed.

property RefCount: Integer read write

SetResponse

Used for setting server response. for internal usage only!

procedure SetResponse(aResponse: TStream)

Parameters:

  • aResponse: Response

Start

procedure Start

UserData

User data

property UserData: Pointer read write

 

AsyncException

This property stores the exception instance from the last run of the asynchronous request

property AsyncException: Exception read write

Cancelled

Boolean property shows was asynchonous request canceled or not.

property Cancelled: Boolean read write

Channel

The client channel that the request is being executed for. Read-only and mainly for reference and internal use.

property Channel: IROTransportChannel read write

Done

Indicates that request was finished

property Done: Boolean read write

Message

Represents reference to request message

property Message: IROMessage read write

RefCount    (declared in TROInterfacedObject)

Provides read-only access to the reference counter. When this value reaches zero, the object is freed.

property RefCount: Integer read write

UserData

User data

property UserData: Pointer read write

 

NewInstance  override    (declared in TROInterfacedObject)

Creates and returns a new instance of the interfaced object, initializing its reference counter with 1.

class function NewInstance: TObject

 

constructor Create

Creates a new instance.

constructor Create(aMessage: IROMessage; aChannel: IROTransportChannel; aCallback: TROAsyncCallback)

Parameters:

  • aMessage: Message
  • aChannel: Channel
  • aCallback: Callback method

Cancel

Aborts the currently running request.

procedure Cancel

DoCancel  protected virtual

procedure DoCancel

DoReadResponse  protected virtual

procedure DoReadResponse

GetCancelled  protected virtual

function GetCancelled: Boolean

GetDone  protected virtual

function GetDone: Boolean

ReadResponse

Reads response. Used in End* methods.

procedure ReadResponse

SetResponse

Used for setting server response. for internal usage only!

procedure SetResponse(aResponse: TStream)

Parameters:

  • aResponse: Response

Start

procedure Start

 

Callback

Callback nethod

property Callback: TROAsyncCallback read write
delegate: procedure Callback(const aRequest: IROAsyncRequest)