java.lang.Object
it.rebirthproject.ufoeb.architecture.messages.interfaces.AbstractQueryMessage<T>
Type Parameters:
T - The value passed to the complete action
All Implemented Interfaces:
Message
Direct Known Subclasses:
IsListenerRegisteredMessage

public abstract class AbstractQueryMessage<T> extends Object implements Message
The abstract class defining a query message that can be used by the bus infrastructure.
  • Field Details

    • futureResponse

      private final CompletableFuture<T> futureResponse
      A completable future used to return some query value, for example a boolean stating if a listener is registered to the bus.
  • Constructor Details

    • AbstractQueryMessage

      public AbstractQueryMessage()
  • Method Details

    • getResponse

      public Future<T> getResponse()
      Getter for the future response
      Returns:
      The future containing the query response value.
    • complete

      public void complete(T response)
      A method useful to notify that an action is completed in the future without exception
      Parameters:
      response - The response value of the completed action
    • completeWithException

      public void completeWithException(Exception e)
      A method useful to notify that an action thrown exception while completing.
      Parameters:
      e - The exception thrown while completing the action
    • toString

      public String toString()
      A method that serializes the message class name.
      Overrides:
      toString in class Object