Class BehavioralDrasylNode

java.lang.Object
org.drasyl.node.DrasylNode
org.drasyl.node.behaviour.BehavioralDrasylNode

public abstract class BehavioralDrasylNode extends DrasylNode
Describes a DrasylNode as a finite state machine.

Note: Unlike the default DrasylNode, this node can only process one event at a time. Please consider to run long-running operations asynchronously in a separate thread.

  • Constructor Details

    • BehavioralDrasylNode

      protected BehavioralDrasylNode() throws DrasylException
      Throws:
      DrasylException
    • BehavioralDrasylNode

      protected BehavioralDrasylNode(DrasylConfig config) throws DrasylException
      Throws:
      DrasylException
    • BehavioralDrasylNode

      protected BehavioralDrasylNode(Identity identity, io.netty.bootstrap.ServerBootstrap bootstrap, io.netty.channel.ChannelFuture channelFuture, io.netty.channel.Channel channel, Behavior behavior, List<SocketAddress> sntpServers)
    • BehavioralDrasylNode

      protected BehavioralDrasylNode(Identity identity, io.netty.bootstrap.ServerBootstrap bootstrap, io.netty.channel.ChannelFuture channelFuture, List<SocketAddress> sntpServers)
  • Method Details

    • onEvent

      public final void onEvent(@NonNull Event event)
      Description copied from class: DrasylNode
      Sends event to the application and tells it information about the local node, other peers, connections or incoming messages.
      Specified by:
      onEvent in class DrasylNode
      Parameters:
      event - the event
    • created

      protected abstract Behavior created()
      Returns the initial Behavior of the node.
      Returns:
      the initial Behavior
    • newBehaviorBuilder

      protected Behavior.BehaviorBuilder newBehaviorBuilder()
      Creates a new Behavior.BehaviorBuilder to build a new Behavior for inbound message/event handling.