Module aeonics.core

Class Origin.NetworkServer

  • All Implemented Interfaces:
    Exportable, Snapshotable, java.io.Closeable, java.lang.AutoCloseable
    Enclosing class:
    Origin

    public static class Origin.NetworkServer
    extends Origin.Type
    This class represents a data Origin that listens for network data.

    If the connection is interrupted, this endpoint will attempt to reconnect every second (unless it is stopped).

    You should implement the connect() method and call the Origin.Type.emit(Message, String) method to inject data in the system.

    • Constructor Detail

      • NetworkServer

        public NetworkServer()
    • Method Detail

      • connect

        public Network.Server connect()
                               throws java.lang.Exception
        Returns a server network connection.
        Returns:
        a server network connection
        Throws:
        java.lang.Exception - if an error happens while establishing the connection
      • connect

        public <T extends Origin.NetworkServer> T connect​(java.util.function.Supplier<Network.Server> connecter)
        Sets the connect function as an alternative to connect().
        Type Parameters:
        T - this
        Parameters:
        connecter - the connect function
        Returns:
        this
      • start

        public void start()
        Description copied from class: Origin.Type
        Starts this Origin entity. The Origin can only be started if it is currently stopped, otherwise it does nothing. Implementations are responsible to set and maintain the internal state.
        Overrides:
        start in class Origin.Type
      • stop

        public void stop()
        Description copied from class: Origin.Type
        Stops this Origin entity. The Origin can only be stopped if it is currently running, otherwise it does nothing. Implementations are responsible to set and maintain the internal state.
        Overrides:
        stop in class Origin.Type