CommandableAzureFunction class abstract

Abstract Azure function, that acts as a container to instantiate and run components and expose them via external entry point. All actions are automatically generated for commands defined in ICommandable components. Each command is exposed as an action defined by "cmd" parameter.

Container configuration for this Azure function is stored in "./config/config.yml" file. But this path can be overriden by CONFIG_PATH environment variable.

Note: This component has been deprecated. Use Azure Function Controller instead.

References

  • *:logger:*:*:1.0 (optional) ILogger components to pass log messages
  • *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements
  • *:controller:azurefunc:*:1.0 (optional) IAzureFunctionController controllers to handle action requests
  • *:controller:commandable-azurefunc:*:1.0 (optional) IAzureFunctionController controllers to handle action requests

See AzureFunctionClient

Example

class MyAzureFunction extends CommandableAzureFunction {
    IMyController _service;
    ...
    MyAzureFunction()
        super('mygroup', 'MyGroup Azure function'){
        dependencyResolver.put(
            'service',
            Descriptor('mygroup','service','*','*','1.0')
        );
    }

var azureFunction = new MyAzureFunction();

azureFunction.run((err) => {
    console.log("MyAzureFunction is started");
});
Inheritance

Constructors

CommandableAzureFunction(String name, [String? description])
Creates a new instance of this Azure function.

Properties

actions Map<String, Future Function(Map<String, dynamic>)>
The map of registered actions.
read / writeinherited
config ContainerConfig?
read / writeinherited
configPath String
The default path to config file.
read / writeinherited
counters CompositeCounters
The performanc counters.
finalinherited
dependencyResolver DependencyResolver
The dependency resolver.
finalinherited
factories DefaultContainerFactory
read / writeinherited
hashCode int
The hash code for this object.
read-onlyinherited
info ContextInfo?
read / writeinherited
logger ILogger
read / writeinherited
references ContainerReferences?
read / writeinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
schemas Map<String, Schema>
The map of registred validation schemas.
read / writeinherited
tracer CompositeTracer
finalinherited

Methods

act(Map<String, dynamic> context) Future
Calls registered action in this Azure function. 'cmd' parameter in the action parameters determin what action shall be called.
inherited
addFactory(IFactory factory) → void
Adds a factory to the container. The factory is used to create components added to the container by their locators (descriptors).
inherited
close(IContext? context) Future
Closes component and frees used resources.
inherited
configure(ConfigParams config) → void
Configures component by passing configuration parameters.
inherited
getCommand(Map<String, dynamic> context) String
Returns command from Azure Function context. This method can be overloaded in child classes
inherited
getHandler() Future Function(Map<String, dynamic> context)
Gets entry point into this Azure function.
inherited
getParametrs(Map<String, dynamic> context) Parameters
Returns body from Azure Function context. This method can be overloaded in child classes
getTraceId(Map<String, dynamic> context) String
Returns context from Azure Function context. This method can be overloaded in child classes
inherited
instrument(IContext? context, String name) InstrumentTiming
Adds instrumentation to log calls and measure call time. It returns a Timing object that is used to end the time measurement.
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
readConfigFromFile(IContext? context, String path, ConfigParams parameters) Future
Reads container configuration from JSON or YAML file and parameterizes it with given values.
inherited
register() → void
Registers all actions in this Azure function.
override
registerAction(String? cmd, Schema? schema, Future action(Map<String, dynamic>)) → void
Registers an action in this Azure function.
inherited
registerControllers() → void
Registers all Azure controllers in the container.
inherited
run() Future
Runs this Azure function, loads container configuration, instantiate components and manage their lifecycle, makes this function ready to access action calls.
inherited
setReferences(IReferences references) → void
Sets references to dependent components.
inherited
toString() String
A string representation of this object.
inherited
unsetReferences() → void
Unsets (clears) previously set references to dependent components.
inherited

Operators

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