Class FlowModule
Base class for all modules, but you will probably use FlowModule<TSettings> for your implementation
Inheritance
Inherited Members
Namespace: Crosser.EdgeNode.Flows.FlowModule
Assembly: Crosser.EdgeNode.Flows.dll
Syntax
public abstract class FlowModule : IFlowModule, IDisposable
Constructors
FlowModule(FlowModuleType)
Constructor for FlowModule
Declaration
protected FlowModule(FlowModuleType moduleType)
Parameters
|
FlowModuleType
moduleType
|
Properties
Categories
Sets the tags to be able to group modules together representing similar functionality
Declaration
public List<string> Categories { get; set; }
Property Value
|
System.Collections.Generic.List<System.String>
|
Implements
Debug
If true the module will log messages in/out from the module. Note that the log will use Verbose level
Declaration
public bool Debug { get; set; }
Property Value
|
System.Boolean
|
Implements
Disabled
If true the module will ignore messages coming in
Declaration
public bool Disabled { get; set; }
Property Value
|
System.Boolean
|
Implements
FlowContext
Reference to the flow specific context that the module belongs to
Declaration
public RepositoryInstance<string, dynamic> FlowContext { get; }
Property Value
|
Crosser.EdgeNode.Common.Abstractions.Utilities.Persistence.RepositoryInstance<System.String, System.Object>
|
Implements
FlowId
Id of the flow that the module belongs to
Declaration
public Guid FlowId { get; set; }
Property Value
|
System.Guid
|
Implements
FlowStatistics
Declaration
public FlowStatistics FlowStatistics { get; set; }
Property Value
|
FlowStatistics
|
Implements
HaltOnError
If true the module and flow will be stopped when OnError is called
Declaration
public bool HaltOnError { get; set; }
Property Value
|
System.Boolean
|
Implements
HasInput
If true you can pass data to this module
Declaration
public bool HasInput { get; set; }
Property Value
|
System.Boolean
|
Implements
HasOutput
if Outputs Count is > 0 this will be true
Declaration
public bool HasOutput { get; }
Property Value
|
System.Boolean
|
Implements
Id
Unique Id for the module instance
Declaration
public Guid Id { get; set; }
Property Value
|
System.Guid
|
Implements
MaxNrOfOutputs
The maximum number of outputs for the module, defaults to 1 so set this in your custom module if needed
Declaration
public int MaxNrOfOutputs { get; set; }
Property Value
|
System.Int32
|
Metadata
Metadata for this module
Declaration
public Dictionary<string, dynamic> Metadata { get; set; }
Property Value
|
System.Collections.Generic.Dictionary<System.String, System.Object>
|
Implements
ModuleProtocol
If the module uses a specific protocol for communication is should be registered here to make routers able to locate the module
Declaration
public FlowModuleProtocol ModuleProtocol { get; set; }
Property Value
|
FlowModuleProtocol
|
Implements
ModuleStatistics
Declaration
public FlowModuleStatistics ModuleStatistics { get; set; }
Property Value
|
FlowModuleStatistics
|
Implements
ModuleType
The module type implemented. See ModuleType
Declaration
public FlowModuleType ModuleType { get; set; }
Property Value
|
FlowModuleType
|
Implements
ModuleVersion
Declaration
public string ModuleVersion { get; set; }
Property Value
|
System.String
|
Implements
Name
Name of the module at runtime (set by users using the module in the flow)
Declaration
public string Name { get; set; }
Property Value
|
System.String
|
Implements
NoError
Declaration
protected static Task<IError> NoError { get; }
Property Value
|
System.Threading.Tasks.Task<IError>
|
NrOfOutputs
The available number of outputs from the module
Declaration
public int NrOfOutputs { get; }
Property Value
|
System.Int32
|
Remarks
Each output can have several modules connected to it
OnDebug
Declaration
public EventHandler<ModuleDebugMessage> OnDebug { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.ModuleDebugMessage>
|
Implements
OnError
Declaration
public EventHandler<FlowModuleException> OnError { get; set; }
Property Value
|
System.EventHandler<FlowModuleException>
|
Implements
OnFlowDataReceived
Declaration
public EventHandler<FlowStatisticsData> OnFlowDataReceived { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowStatisticsData>
|
Implements
OnFlowDataSent
Declaration
public EventHandler<FlowStatisticsData> OnFlowDataSent { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowStatisticsData>
|
Implements
OnModuleDataReceived
Declaration
public EventHandler<FlowModuleStatisticsData> OnModuleDataReceived { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowModuleStatisticsData>
|
Implements
OnModuleDataSent
Declaration
public EventHandler<FlowModuleStatisticsData> OnModuleDataSent { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowModuleStatisticsData>
|
Implements
OnStatusChanged
Declaration
public EventHandler<FlowStatusEvent> OnStatusChanged { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.FlowStatusEvent>
|
Implements
OnTimeSeriesDataSent
Declaration
public EventHandler<TimeSeriesDataValues> OnTimeSeriesDataSent { get; set; }
Property Value
|
System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.TimeSeriesDataValues>
|
Implements
OnWarning
Declaration
public EventHandler<FlowModuleException> OnWarning { get; set; }
Property Value
|
System.EventHandler<FlowModuleException>
|
Implements
Outputs
The actual outputs from the module
Declaration
public List<RepositoryInstance<Guid, IFlowModule>> Outputs { get; set; }
Property Value
|
System.Collections.Generic.List<Crosser.EdgeNode.Common.Abstractions.Utilities.Persistence.RepositoryInstance<System.Guid, IFlowModule>>
|
Implements
ReceivesInputFromMultipleModules
Declaration
public bool ReceivesInputFromMultipleModules { get; set; }
Property Value
|
System.Boolean
|
Implements
RemoteSessionEnabled
Declaration
public bool RemoteSessionEnabled { get; set; }
Property Value
|
System.Boolean
|
Implements
Resources
Declaration
public IList<ResourceBase> Resources { get; set; }
Property Value
|
System.Collections.Generic.IList<Crosser.EdgeNode.Flows.Abstractions.Models.Resources.ResourceBase>
|
Implements
Settings
Declaration
public FlowModuleSettings Settings { get; protected set; }
Property Value
|
FlowModuleSettings
|
Implements
Status
Topic
To get the topic for routing modules. This setting should be refactored with the ModuleType later on.
Declaration
public string Topic { get; protected set; }
Property Value
|
System.String
|
Implements
Type
UserFriendlyName
Name to present to users
Declaration
public abstract string UserFriendlyName { get; }
Property Value
|
System.String
|
Implements
Methods
AllowMessageToEnterModule(IFlowMessage)
Declaration
protected abstract bool AllowMessageToEnterModule(IFlowMessage message)
Parameters
|
IFlowMessage
message
|
Returns
|
System.Boolean
|
BypassMessageNotMatchingRules()
Declaration
protected abstract bool BypassMessageNotMatchingRules()
Returns
|
System.Boolean
|
CanStart()
Implement in your module class. This will be called before the call to Start() is made, but after the call to Initialize()
Declaration
public virtual IError CanStart()
Returns
|
IError
Null if the module can start, otherwise an IError. |
Implements
Dispose()
Declaration
public virtual void Dispose()
Implements
Initialize()
This method will be called when the flow is about to be started, but before the call to Start()
Declaration
public virtual Task<IError> Initialize()
Returns
|
System.Threading.Tasks.Task<IError>
An awaitable Task |
Implements
LoadSettings(String)
Declaration
public abstract void LoadSettings(string settingsAsJson)
Parameters
|
System.String
settingsAsJson
|
Implements
MessageReceived(IFlowMessage)
Implement this method in your custom modules to implement logic for the FlowMessage passing through the module. If you want to pass data to the next IFlowModule you should call Next(IFlowMessage[]) in this method
Declaration
protected abstract Task MessageReceived(IFlowMessage msg)
Parameters
|
IFlowMessage
msg
The FlowMessage passed into the module |
Returns
|
System.Threading.Tasks.Task
An awaitable Task |
Next(IFlowMessage[])
When you want to pass the message(s) to the next module(s) in the. This should be called from the MessageReceived(IFlowMessage) method.
Declaration
protected Task Next(params IFlowMessage[] messages)
Parameters
|
IFlowMessage[]
messages
The parameter is 0 to n FlowMessage" |
Returns
|
System.Threading.Tasks.Task
An awaitable Task |
Receive(IFlowMessage)
Passing data to this will flag the module to process the message. In most cases this will be done by the flow-engine or the flow but in special cases you can call this manually to trigger the processing of a message
Declaration
public Task Receive(IFlowMessage msg)
Parameters
|
IFlowMessage
msg
The FlowMessage passed into the module |
Returns
|
System.Threading.Tasks.Task
An awaitable Task |
Implements
ReceiveFrom(IFlowModule, Int32)
Will register the module passed in as a receiver from this module. The module will will be registered at output index 0 by default
Declaration
public IFlowModule ReceiveFrom(IFlowModule module, int ix = 0)
Parameters
|
IFlowModule
module
The module to receive data |
|
System.Int32
ix
The output-index to register the module on |
Returns
|
IFlowModule
|
Implements
SendTimeSeriesData(IFlowMessage)
Declaration
protected abstract void SendTimeSeriesData(IFlowMessage message)
Parameters
|
IFlowMessage
message
|
SendTo(IFlowModule, Int32)
Will pass messages this module to the module passed in
Declaration
public IFlowModule SendTo(IFlowModule module, int ix = 0)
Parameters
|
IFlowModule
module
The module that will receive the data |
|
System.Int32
ix
The output index to add the module to |
Returns
|
IFlowModule
The module that will receive the data (the module passed in) |
Implements
SetMetadataValue(String, Object, Boolean)
Write a metadata value into the key/value storage
Declaration
protected void SetMetadataValue(string key, dynamic value, bool force = false)
Parameters
|
System.String
key
the key as a string |
|
System.Object
value
object to store |
|
System.Boolean
force
pass in true to override previous value |
SetNrOfOutputs(Int32)
Declaration
protected void SetNrOfOutputs(int value)
Parameters
|
System.Int32
value
|
SetStatus(Status)
Set the Status of the module. If the current status is different the OnStatusChanged event will be triggered.
Declaration
public void SetStatus(Status status)
Parameters
|
Status
status
The new Status |
Implements
SetStatus(Status, String)
Set the Status of the module. If the current status is different the OnStatusChanged event will be triggered.
Declaration
public void SetStatus(Status status, string message = null)
Parameters
|
Status
status
The new Status |
|
System.String
message
The message to attach to the Crosser.EdgeNode.Flows.Abstractions.FlowStatusEvent |
Implements
SetStatus(Status, String, Boolean)
Set the Status of the module. If the current status is different the OnStatusChanged event will be triggered.
Declaration
public void SetStatus(Status status, string message = null, bool force = false)
Parameters
|
Status
status
The new Status |
|
System.String
message
The message to attach to the Crosser.EdgeNode.Flows.Abstractions.FlowStatusEvent |
|
System.Boolean
force
Pass true to force the OnStatusChanged event to be triggered regardless of current status |
Implements
Start()
This method will be called when the flow is about to be started, but after the call to Initialize()
Declaration
public virtual Task<IError> Start()
Returns
|
System.Threading.Tasks.Task<IError>
A IError describing the error. If null there was no error. |
Implements
Stop()
This method will be called when the flow is about to be stopped.
Declaration
public virtual Task Stop()
Returns
|
System.Threading.Tasks.Task
An awaitable Task |
Implements
UpdateFlowReceivedStatistics(Int64)
Declaration
protected void UpdateFlowReceivedStatistics(long size = 0L)
Parameters
|
System.Int64
size
|
UpdateFlowSentStatistics(Int64)
Declaration
protected void UpdateFlowSentStatistics(long size = 0L)
Parameters
|
System.Int64
size
|
UpdateModuleReceivedStatistics(Int64)
Declaration
protected void UpdateModuleReceivedStatistics(long size = 0L)
Parameters
|
System.Int64
size
|
UpdateModuleSentStatistics(Int64)
Declaration
protected void UpdateModuleSentStatistics(long size = 0L)
Parameters
|
System.Int64
size
|
ValidateSettings(SettingsValidator)
Declaration
public virtual void ValidateSettings(SettingsValidator validator)
Parameters
|
SettingsValidator
validator
|