This registry holds a map for message handler to process messages.

Accordingly, there are methods for adding handlers

void addMessageHandler(@Nullable IId aMID,
                       @NotNull IMessageHandler aHandler);

or to remove handlers:

void removeMessageHandler(@NotNull IId aMID);

void removeMessageHandler(@NotNull IId aMID,
                          @NotNull IMessageHandler aHandler);

The key for the map is a message ID. A special case is the message ID null, since this message handler receives all messages for which no message handlers have been installed.

The registry also has its own method for processing messages:

void handleMessage(@NotNull CMessage aMsg) throws Exception;

Debug support

There are a few methods to support logging. There is a method to set the message logger which is responsible for preparing the log text:

void setMessageLogger(IMessageLogger aMessageLogger);

In addition, logging must be explicitly enabled, since not all messages may be logged for security reasons:

void setVerbose(boolean aVerbose);
boolean isVerbose();

It should be noted that the registry does not log itself, but only provides the data. This additionally requires the LOG level of the owner of the registry to be set to TRACE. Usually the owner of the registry is a target. - Innovative Distributed System