Package de.kentoj.scrowlib.messaging
Class NatsMessageBroker
java.lang.Object
de.kentoj.scrowlib.messaging.NatsMessageBroker
- All Implemented Interfaces:
MessageBroker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(String subject, RequestHandler handler) Registers a handler for a subject, the handler will receive requests and compute some result.voidRuns blocking.org.bson.DocumentRuns blocking.voidsubscribes to a subject, consumer may run asynchronously
-
Constructor Details
-
NatsMessageBroker
public NatsMessageBroker(io.nats.client.Connection nats)
-
-
Method Details
-
publish
Description copied from interface:MessageBrokerRuns blocking. publishes to the message broker- Specified by:
publishin interfaceMessageBroker- Parameters:
subject- subject to publish to
-
subscribe
Description copied from interface:MessageBrokersubscribes to a subject, consumer may run asynchronously- Specified by:
subscribein interfaceMessageBroker- Parameters:
subject- subject to publish to
-
handle
Description copied from interface:MessageBrokerRegisters a handler for a subject, the handler will receive requests and compute some result. The result is sent back as a reply.- Specified by:
handlein interfaceMessageBroker- Parameters:
subject- subject to publish to
-
request
Description copied from interface:MessageBrokerRuns 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:
requestin interfaceMessageBroker- Parameters:
subject- subject to publish to- Returns:
- RemoteException if the remote throws an exception while handling the request
-