Package org.eso.ias.command
Class CommandManager
java.lang.Object
org.eso.ias.command.CommandManager
- Direct Known Subclasses:
CommandManagerKafkaImpl
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
close()
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.
-
Field Details
-
id
The ID of the process where the object of this class runs
-
-
Constructor Details
-
CommandManager
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 ofDefaultCommandExecutor
or an object extendingDefaultCommandExecutor
to customize the commands- Parameters:
commandListener
- The listener of commands that execute all the commandscloseable
- 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.
-