Show / Hide Table of Contents

    Class FlowModule

    Base class for all modules, but you will probably use FlowModule<TSettings> for your implementation

    Inheritance
    System.Object
    FlowModule
    FlowModule<TSettings>
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    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
    IFlowModule.Categories

    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
    IFlowModule.Debug

    Disabled

    If true the module will ignore messages coming in

    Declaration
    public bool Disabled { get; set; }
    Property Value
    System.Boolean

    Implements
    IFlowModule.Disabled

    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
    IFlowModule.FlowContext

    FlowId

    Id of the flow that the module belongs to

    Declaration
    public Guid FlowId { get; set; }
    Property Value
    System.Guid

    Implements
    IFlowModule.FlowId

    FlowStatistics

    Declaration
    public FlowStatistics FlowStatistics { get; set; }
    Property Value
    FlowStatistics

    Implements
    IFlowModule.FlowStatistics

    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
    IFlowModule.HaltOnError

    HasInput

    If true you can pass data to this module

    Declaration
    public bool HasInput { get; set; }
    Property Value
    System.Boolean

    Implements
    IFlowModule.HasInput

    HasOutput

    if Outputs Count is > 0 this will be true

    Declaration
    public bool HasOutput { get; }
    Property Value
    System.Boolean

    Implements
    IFlowModule.HasOutput

    Id

    Unique Id for the module instance

    Declaration
    public Guid Id { get; set; }
    Property Value
    System.Guid

    Implements
    IFlowModule.Id

    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
    IFlowModule.Metadata

    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
    IFlowModule.ModuleProtocol

    ModuleStatistics

    Declaration
    public FlowModuleStatistics ModuleStatistics { get; set; }
    Property Value
    FlowModuleStatistics

    Implements
    IFlowModule.ModuleStatistics

    ModuleType

    The module type implemented. See ModuleType

    Declaration
    public FlowModuleType ModuleType { get; set; }
    Property Value
    FlowModuleType

    Implements
    IFlowModule.ModuleType

    ModuleVersion

    Declaration
    public string ModuleVersion { get; set; }
    Property Value
    System.String

    Implements
    IFlowModule.ModuleVersion

    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
    IFlowModule.Name

    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
    IFlowModule.OnDebug

    OnError

    Declaration
    public EventHandler<FlowModuleException> OnError { get; set; }
    Property Value
    System.EventHandler<FlowModuleException>

    Implements
    IFlowModule.OnError

    OnFlowDataReceived

    Declaration
    public EventHandler<FlowStatisticsData> OnFlowDataReceived { get; set; }
    Property Value
    System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowStatisticsData>

    Implements
    IFlowModule.OnFlowDataReceived

    OnFlowDataSent

    Declaration
    public EventHandler<FlowStatisticsData> OnFlowDataSent { get; set; }
    Property Value
    System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowStatisticsData>

    Implements
    IFlowModule.OnFlowDataSent

    OnModuleDataReceived

    Declaration
    public EventHandler<FlowModuleStatisticsData> OnModuleDataReceived { get; set; }
    Property Value
    System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowModuleStatisticsData>

    Implements
    IFlowModule.OnModuleDataReceived

    OnModuleDataSent

    Declaration
    public EventHandler<FlowModuleStatisticsData> OnModuleDataSent { get; set; }
    Property Value
    System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.FlowModuleStatisticsData>

    Implements
    IFlowModule.OnModuleDataSent

    OnStatusChanged

    Declaration
    public EventHandler<FlowStatusEvent> OnStatusChanged { get; set; }
    Property Value
    System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.FlowStatusEvent>

    Implements
    IFlowModule.OnStatusChanged

    OnTimeSeriesDataSent

    Declaration
    public EventHandler<TimeSeriesDataValues> OnTimeSeriesDataSent { get; set; }
    Property Value
    System.EventHandler<Crosser.EdgeNode.Flows.Abstractions.Models.Messaging.TimeSeriesDataValues>

    Implements
    IFlowModule.OnTimeSeriesDataSent

    OnWarning

    Declaration
    public EventHandler<FlowModuleException> OnWarning { get; set; }
    Property Value
    System.EventHandler<FlowModuleException>

    Implements
    IFlowModule.OnWarning

    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
    IFlowModule.Outputs

    ReceivesInputFromMultipleModules

    Declaration
    public bool ReceivesInputFromMultipleModules { get; set; }
    Property Value
    System.Boolean

    Implements
    IFlowModule.ReceivesInputFromMultipleModules

    RemoteSessionEnabled

    Declaration
    public bool RemoteSessionEnabled { get; set; }
    Property Value
    System.Boolean

    Implements
    IFlowModule.RemoteSessionEnabled

    Resources

    Declaration
    public IList<ResourceBase> Resources { get; set; }
    Property Value
    System.Collections.Generic.IList<Crosser.EdgeNode.Flows.Abstractions.Models.Resources.ResourceBase>

    Implements
    IFlowModule.Resources

    Settings

    Declaration
    public FlowModuleSettings Settings { get; protected set; }
    Property Value
    FlowModuleSettings

    Implements
    IFlowModule.Settings

    Status

    Declaration
    public Status Status { get; }
    Property Value
    Status

    Implements
    IFlowModule.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
    IFlowModule.Topic

    Type

    Declaration
    public string Type { get; }
    Property Value
    System.String

    Implements
    IFlowModule.Type

    UserFriendlyName

    Name to present to users

    Declaration
    public abstract string UserFriendlyName { get; }
    Property Value
    System.String

    Implements
    IFlowModule.UserFriendlyName

    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
    IFlowModule.CanStart()

    Dispose()

    Declaration
    public virtual void Dispose()
    Implements
    System.IDisposable.Dispose()

    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
    IFlowModule.Initialize()

    LoadSettings(String)

    Declaration
    public abstract void LoadSettings(string settingsAsJson)
    Parameters
    System.String settingsAsJson

    Implements
    IFlowModule.LoadSettings(String)

    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
    IFlowModule.Receive(IFlowMessage)

    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
    IFlowModule.ReceiveFrom(IFlowModule, Int32)

    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
    IFlowModule.SendTo(IFlowModule, Int32)

    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
    IFlowModule.SetStatus(Status)

    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
    IFlowModule.SetStatus(Status, String)

    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
    IFlowModule.SetStatus(Status, String, Boolean)

    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
    IFlowModule.Start()

    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
    IFlowModule.Stop()

    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

    Implements
    IFlowModule.ValidateSettings(SettingsValidator)
    Back to top Crosser SDK