CommandableAzureFunctionClient class
Abstract client that calls commandable Azure Functions.
Commandable services are generated automatically for ICommandable. Each command is exposed as action determined by "cmd" parameter.
Configuration parameters
connections
:- uri: (optional) full connection string or use protocol, app_name and function_name to build
protocol
: (optional) connection protocolapp_name
: (optional) Azure Function application namefunction_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
Example
class MyAzureFunctionClient extends CommandableAzureFunctionClient implements IMyClient {
...
Future<MyData> getData(IContext? context, id: string) async {
var result = await callCommand(
"get_data",
context,
{ id: id }
);
}
...
}
var client = new 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');
- Inheritance
-
- Object
- AzureFunctionClient
- CommandableAzureFunctionClient
Constructors
- CommandableAzureFunctionClient(String name)
- Creates a new instance of this client.
Properties
- client ↔ Client?
-
The HTTP client
read / writeinherited
- connection ↔ AzureFunctionConnectionParams?
-
The Azure function connection parameters
read / writeinherited
- connectionResolver → AzureFunctionConnectionResolver
-
The connection resolver.
finalinherited
- counters → CompositeCounters
-
The performance counters.
finalinherited
- dependencyResolver → DependencyResolver
-
The dependencies resolver.
finalinherited
- hashCode → int
-
The hash code for this object.
read-onlyinherited
-
headers
↔ Map<
String, String> -
The default headers to be added to every request.
read / writeinherited
- logger → CompositeLogger
-
The logger.
finalinherited
- opened ↔ bool
-
The opened flag.
read / writeinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- tracer → CompositeTracer
-
finalinherited
- uri ↔ String?
-
The remote controller uri which is calculated on open.
read / writeinherited
Methods
-
call(
String cmd, IContext? context, dynamic params) → Future -
Calls a Azure Function action.
inherited
-
callCommand(
String cmd, IContext? context, dynamic params) → Future - Calls a remote action in Azure Function. The name of the action is added as "cmd" parameter to the action parameters.
-
close(
IContext? context) → Future -
Closes component and frees used resources.
inherited
-
configure(
ConfigParams config) → void -
Configures component by passing configuration parameters.
inherited
-
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.
inherited
-
invoke(
String? cmd, IContext? context, Map args) → Future -
Performs Azure Function invocation.
inherited
-
isOpen(
) → bool -
Checks if the component is opened.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
IContext? context) → Future -
Opens the component.
inherited
-
setReferences(
IReferences references) → void -
Sets references to dependent components.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited