Class InMemoyMessageBroker

java.lang.Object
de.kentoj.scrowlib.messaging.InMemoyMessageBroker
All Implemented Interfaces:
MessageBroker

public class InMemoyMessageBroker extends Object implements MessageBroker
  • Constructor Details

    • InMemoyMessageBroker

      public InMemoyMessageBroker()
  • Method Details

    • publish

      public void publish(String subject, org.bson.Document document)
      Description copied from interface: MessageBroker
      Runs blocking. publishes to the message broker
      Specified by:
      publish in interface MessageBroker
      Parameters:
      subject - subject to publish to
    • subscribe

      public void subscribe(String subject, Consumer<org.bson.Document> consumer)
      Description copied from interface: MessageBroker
      subscribes to a subject, consumer may run asynchronously
      Specified by:
      subscribe in interface MessageBroker
      Parameters:
      subject - subject to publish to
    • handle

      public void handle(String subject, RequestHandler handler)
      Description copied from interface: MessageBroker
      Registers a handler for a subject, the handler will receive requests and compute some result. The result is sent back as a reply.
      Specified by:
      handle in interface MessageBroker
      Parameters:
      subject - subject to publish to
    • request

      public org.bson.Document request(String subject, org.bson.Document document)
      Description copied from interface: MessageBroker
      Runs blocking. Executes an RPC call: The document is published and this method starts listening for incoming replies. The returned Result holds either a document with the requested data, or an error as a string
      Specified by:
      request in interface MessageBroker
      Parameters:
      subject - subject to publish to
      Returns:
      RemoteException if the remote throws an exception while handling the request