Class RemoteServiceInvoker
- Namespace
- GroupeIsa.Neos.ClusterCommunication
- Assembly
- GroupeIsa.Neos.ClusterCommunication.dll
Represents the implementation of a client for interacting with the Dapr endpoints over HTTP protocol.
public class RemoteServiceInvoker : RemoteServiceInvokerBase, IRemoteServiceInvoker
- Inheritance
-
RemoteServiceInvoker
- Implements
- Inherited Members
Constructors
RemoteServiceInvoker(IConfiguration, IHttpClientFactory, IHttpContextAccessor, IApplicationContext, INeosTracer, IDaprIdProvider, INeosLogger<RemoteServiceInvoker>)
Initializes a new instance of the RemoteServiceInvoker class.
public RemoteServiceInvoker(IConfiguration configuration, IHttpClientFactory httpClientFactory, IHttpContextAccessor httpContextAccessor, IApplicationContext applicationContext, INeosTracer neosTracer, IDaprIdProvider daprIdProvider, INeosLogger<RemoteServiceInvoker> logger)
Parameters
configurationIConfigurationThe configuration.
httpClientFactoryIHttpClientFactoryThe http client factory.
httpContextAccessorIHttpContextAccessorProvides access to the current HttpContext.
applicationContextIApplicationContextThe application context.
neosTracerINeosTracerThe Neos tracer.
daprIdProviderIDaprIdProviderThe daprId provider.
loggerINeosLogger<RemoteServiceInvoker>The logger.
Methods
GetByteArrayAsync(RemoteServiceOptions, CancellationToken)
Send a GET request with the specified options and return the response body as a byte array.
public override Task<byte[]> GetByteArrayAsync(RemoteServiceOptions options, CancellationToken cancellationToken)
Parameters
optionsRemoteServiceOptionsThe options to invoke the method on.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<byte[]>
A Task<TResult> that will return when the operation has completed with byte array.
GetStringAsync(RemoteServiceOptions, CancellationToken)
Send a GET request with the specified options and return the response body as a string.
public override Task<string> GetStringAsync(RemoteServiceOptions options, CancellationToken cancellationToken)
Parameters
optionsRemoteServiceOptionsThe options to invoke the method on.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<string>
A Task<TResult> that will return when the operation has completed with string.
InvokeAsync(RemoteServiceOptions, CancellationToken)
Performs service invocation for the service identified by options.ServiceId.ServiceId and invokes the resource
specified by options.Path.Path with the HTTP method.options.HttpMethod.HttpMethod
public override Task InvokeAsync(RemoteServiceOptions options, CancellationToken cancellationToken)
Parameters
optionsRemoteServiceOptionsThe options to invoke the method on.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task
A Task<TResult> that will return when the operation has completed.
InvokeAsync<TResponse>(RemoteServiceOptions, CancellationToken)
Performs service invocation for the service identified by options.ServiceId.ServiceId and invokes the resource
specified by options.Path.Path with the HTTP method.options.HttpMethod.HttpMethod
public override Task<TResponse?> InvokeAsync<TResponse>(RemoteServiceOptions options, CancellationToken cancellationToken)
Parameters
optionsRemoteServiceOptionsThe options to invoke the method on.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TResponse>
A Task<TResult> that will return when the operation has completed.
Type Parameters
TResponseThe type of the data that will be JSON deserialized from the response body.
SendAsync(RemoteServiceOptions, HttpClient?, CancellationToken)
Performs service invocation for the service identified by options.ServiceId.ServiceId and invokes the resource
specified by options.Path.Path with the HTTP method.options.HttpMethod.HttpMethod
public override Task<HttpResponseMessage> SendAsync(RemoteServiceOptions options, HttpClient? client, CancellationToken cancellationToken)
Parameters
optionsRemoteServiceOptionsThe options to invoke the method on.
clientHttpClientProvides a HTTP client for sending HTTP requests and receiving HTTP responses.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<HttpResponseMessage>
A Task<TResult> that will return when the operation has completed.