Search Results for

    Show / Hide Table of Contents

    Interface IMessageListener

    An interface for connecting to a message service, subscribing to a topic, and listening for messages. Used by the system in order for lemonedge to pass messages for synchronisation across services.

    By default the MessageType config setting only allows Azure message bus configuration

    Implementing this interface, and IMessenger, and marking them with the MessageManagerAttribute will expand the options from the config settings to enable using your custom message service.

    You can then configure the use of that by LemonEdge using MessageType, MessageConnectionString and MessageTopicForServerSync config settings

    Inherited Members
    IMessengerBase.CloseAsync()
    Namespace: LemonEdge.API.Messages
    Assembly: API.dll
    Syntax
    public interface IMessageListener : IMessengerBase
    Remarks

    When you have more than one web or task service, the system needs to synchronise the cache between them all. This can be done by either a shared cache server they all connect to, or by passing messages that invalidate local caches.

    The performance between the two is a balance of the number of services being spun up and the general work load.

    This message interface is a simple mechanism to enable the web and task services to communicate with each other to keep everything in sync. Expanding this implementation allows you to use messages using other technologies than the Azure message bus (the default lemonedge messaging option)

    Methods

    AddExceptionHandler(Func<Exception, Task>)

    Adds a handler for dealing with any exceptions for connections or message handling

    Declaration
    void AddExceptionHandler(Func<Exception, Task> exceptionHandler)
    Parameters
    Type Name Description
    System.Func<System.Exception, System.Threading.Tasks.Task> exceptionHandler

    A function that deals with exceptions encountered while listening to messages

    AddMessageProcessor(Func<String, Task>)

    Adds a handler to process any incoming messages for this connection

    Declaration
    void AddMessageProcessor(Func<string, Task> listener)
    Parameters
    Type Name Description
    System.Func<System.String, System.Threading.Tasks.Task> listener

    The function that will be called to process any messages recieved from this connection

    Init(String, String, String)

    Initializes a new MessageListener with the settings to connect to a message service and listen to a specific channel for messages

    Declaration
    Task Init(string connectionString, string topicName, string subscriberName)
    Parameters
    Type Name Description
    System.String connectionString

    The connection string for the message service

    System.String topicName

    The topic for messages

    System.String subscriberName

    The name of the service subscribing to the messages

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task indicating the completion of the operation to connect to the message service

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)

    See Also

    IMessenger
    MessageManagerFactory
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.