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


 

constructor Create (IROMessage, IROTransportChannel, TROAsyncCallback)  overload

Creates a new instance with a supplied values.

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

Parameters:

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

constructor Create (IROMessage, IROTransportChannel, TROAsyncCallbackMethod)  overload

Creates a new instance with a supplied values.

constructor Create(aMessage: IROMessage; aChannel: IROTransportChannel; aCallbackMethod: TROAsyncCallbackMethod)

Parameters:

  • aMessage: Message
  • aChannel: Channel
  • aCallbackMethod: 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
delegate: procedure Callback(const aRequest: IROAsyncRequest)

CallbackMethod

Callback nethod

property CallbackMethod: TROAsyncCallbackMethod read
delegate: procedure CallbackMethod(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

Channel

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

property Channel: IROTransportChannel read

Done

Indicates that request was finished

property Done: Boolean read

Message

Represents reference to request message

property Message: IROMessage read

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

SetResponse

Used for setting server response. for internal usage only!

procedure SetResponse(aResponse: TStream)

Parameters:

  • aResponse: Response

Start

Starts request

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

Channel

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

property Channel: IROTransportChannel read

Done

Indicates that request was finished

property Done: Boolean read

Message

Represents reference to request message

property Message: IROMessage read

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

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 (IROMessage, IROTransportChannel, TROAsyncCallback)  overload

Creates a new instance with a supplied values.

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

Parameters:

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

constructor Create (IROMessage, IROTransportChannel, TROAsyncCallbackMethod)  overload

Creates a new instance with a supplied values.

constructor Create(aMessage: IROMessage; aChannel: IROTransportChannel; aCallbackMethod: TROAsyncCallbackMethod)

Parameters:

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

Cancel

Aborts the currently running request.

procedure Cancel

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

Starts request

procedure Start

 

Callback

Callback nethod

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

CallbackMethod

Callback nethod

property CallbackMethod: TROAsyncCallbackMethod read
delegate: procedure CallbackMethod(const aRequest: IROAsyncRequest)