Class CommandManager

java.lang.Object
org.eso.ias.command.CommandManager
Direct Known Subclasses:
CommandManagerKafkaImpl

public abstract class CommandManager extends Object
The CommandManager base class for command executors subscribes as a consumer of the command topic and as a producer of the reply topic. Its task is to receive the commands for the process where it runs, discarding the commands targeted to other processes. Normally commands are forwarded to the listener for execution and the replies published in the reply topic. SHUTDOWN and RESTART must be executed by the CommandManager because a reply must be sent before shutting down. Commands are executed in a dedicated thread in FIFO order. Received commands are queued and discarded when the queue is full as we do not expect many commands.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The ID of the process where the object of this class runs
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Close the producer and the consumer and release all the allocated resources.
    abstract void
    start(CommandListener commandListener, AutoCloseable closeable)
    Start getting events from the command topic and send them to the passed listener.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • id

      public final String id
      The ID of the process where the object of this class runs
  • Constructor Details

    • CommandManager

      public CommandManager(String id)
      Constructor
      Parameters:
      id - the id of the process
  • Method Details

    • start

      public abstract void start(CommandListener commandListener, AutoCloseable closeable) throws Exception
      Start getting events from the command topic and send them to the passed listener. The listener is usually an instance of DefaultCommandExecutor or an object extending DefaultCommandExecutor to customize the commands
      Parameters:
      commandListener - The listener of commands that execute all the commands
      closeable - The closeable class to free the resources while exiting/restating
      Throws:
      Exception
    • close

      public abstract void close()
      Close the producer and the consumer and release all the allocated resources.