Share via


MethodDispatcherBase.DispatchAsync Method

Definition

Overloads

DispatchAsync(Object, Int32, Object, CancellationToken)

This method is used to dispatch request to the specified methodId of the interface implemented by the remoted object.

DispatchAsync(Object, Int32, IServiceRemotingRequestMessageBody, IServiceRemotingMessageBodyFactory, CancellationToken)

Why we pass IServiceRemotingMessageBodyFactory to this function instead of setting at class level?. Since we cache MethodDispatcher for each interface, we can't set IServiceRemotingMessageBodyFactory at class level. These can be cases where multiple IServiceRemotingMessageBodyFactory implmenetation but single dispatcher class. This method is used to dispatch request to the specified methodId of the interface implemented by the remoted object.

DispatchAsync(Object, Int32, Object, CancellationToken)

This method is used to dispatch request to the specified methodId of the interface implemented by the remoted object.

public override System.Threading.Tasks.Task<object> DispatchAsync (object objectImplementation, int methodId, object requestBody, System.Threading.CancellationToken cancellationToken);
override this.DispatchAsync : obj * int * obj * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
Public Overrides Function DispatchAsync (objectImplementation As Object, methodId As Integer, requestBody As Object, cancellationToken As CancellationToken) As Task(Of Object)

Parameters

objectImplementation
Object

The object impplemented the remoted interface.

methodId
Int32

Id of the method to which to dispatch the request to.

requestBody
Object

The body of the request object that needs to be dispatched to the object.

cancellationToken
CancellationToken

The cancellation token that will be signaled if this operation is cancelled.

Returns

A task that represents the outstanding asynchronous call to the implementation object. The return value of the task contains the returned value from the invoked method.

Applies to

DispatchAsync(Object, Int32, IServiceRemotingRequestMessageBody, IServiceRemotingMessageBodyFactory, CancellationToken)

Why we pass IServiceRemotingMessageBodyFactory to this function instead of setting at class level?. Since we cache MethodDispatcher for each interface, we can't set IServiceRemotingMessageBodyFactory at class level. These can be cases where multiple IServiceRemotingMessageBodyFactory implmenetation but single dispatcher class. This method is used to dispatch request to the specified methodId of the interface implemented by the remoted object.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingResponseMessageBody> DispatchAsync (object objectImplementation, int methodId, Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingRequestMessageBody requestBody, Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingMessageBodyFactory remotingMessageBodyFactory, System.Threading.CancellationToken cancellationToken);
override this.DispatchAsync : obj * int * Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingRequestMessageBody * Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingMessageBodyFactory * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Services.Remoting.V2.IServiceRemotingResponseMessageBody>
Public Function DispatchAsync (objectImplementation As Object, methodId As Integer, requestBody As IServiceRemotingRequestMessageBody, remotingMessageBodyFactory As IServiceRemotingMessageBodyFactory, cancellationToken As CancellationToken) As Task(Of IServiceRemotingResponseMessageBody)

Parameters

objectImplementation
Object

The object impplemented the remoted interface.

methodId
Int32

Id of the method to which to dispatch the request to.

requestBody
IServiceRemotingRequestMessageBody

The body of the request object that needs to be dispatched to the object.

remotingMessageBodyFactory
IServiceRemotingMessageBodyFactory

IServiceRemotingMessageBodyFactory implementaion

cancellationToken
CancellationToken

The cancellation token that will be signaled if this operation is cancelled.

Returns

A task that represents the outstanding asynchronous call to the implementation object. The return value of the task contains the returned value from the invoked method.

Applies to