AzureFunctionClient class abstract

Abstract client that calls Azure Functions.

When making calls 'cmd' parameter determines which what action shall be called, while other parameters are passed to the action itself.

Configuration parameters

  • connections:
    • uri: (optional) full connection string or use protocol, app_name and function_name to build
    • protocol: (optional) connection protocol
    • app_name: (optional) Azure Function application name
    • function_name: (optional) Azure Function name
  • options:
    • retries: number of retries (default: 3)
    • connect_timeout: connection timeout in milliseconds (default: 10 sec)
    • timeout: invocation timeout in milliseconds (default: 10 sec)
  • credentials:
    • auth_code: Azure Function auth code if use custom authorization provide empty string

References

  • *:logger:*:*:1.0 (optional) ILogger components to pass log messages
  • *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements
  • *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection
  • *:credential-store:*:*:1.0 (optional) Credential stores to resolve credentials

See AzureFunction See CommandableAzureFunctionClient

Example

class MyAzureFunctionClient extends AzureFunctionClient implements IMyClient {
    ...

    Future<MyData> getData(IContext? context, String id) async {
        var timing = this.instrument(context, 'myclient.get_data');
        var result = await call('get_data', context, { id: id });
        timing.endTiming();
        return result;
    }
    ...
}

var client = MyAzureFunctionClient();
client.configure(ConfigParams.fromTuples([
   "connection.uri", "http://myapp.azurewebsites.net/api/myfunction",
   "connection.protocol", "http",
   "connection.app_name", "myapp",
   "connection.function_name", "myfunction"
   "credential.auth_code", "XXXX"
]));

var data = client.getData(Context.fromTraceId('123'), '1');
...
Implemented types
Implementers

Constructors

AzureFunctionClient()

Properties

client Client?
The HTTP client
read / write
connection AzureFunctionConnectionParams?
The Azure function connection parameters
read / write
connectionResolver AzureFunctionConnectionResolver
The connection resolver.
final
counters CompositeCounters
The performance counters.
final
dependencyResolver DependencyResolver
The dependencies resolver.
final
hashCode int
The hash code for this object.
read-onlyinherited
headers Map<String, String>
The default headers to be added to every request.
read / write
logger CompositeLogger
The logger.
final
opened bool
The opened flag.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
tracer CompositeTracer
final
uri String?
The remote controller uri which is calculated on open.
read / write

Methods

call(String cmd, IContext? context, dynamic params) Future
Calls a Azure Function action.
close(IContext? context) Future
Closes component and frees used resources.
override
configure(ConfigParams config) → void
Configures component by passing configuration parameters.
override
instrument(IContext? context, String name) InstrumentTiming
Adds instrumentation to log calls and measure call time. It returns a InstrumentTiming object that is used to end the time measurement.
invoke(String? cmd, IContext? context, Map args) Future
Performs Azure Function invocation.
isOpen() bool
Checks if the component is opened.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(IContext? context) Future
Opens the component.
override
setReferences(IReferences references) → void
Sets references to dependent components.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited