Package io.nats.client
Interface MessageHandler
-
public interface MessageHandlerDispatchersuse the MessageHandler interface to define the listener for their messages. Each Dispatcher can have a single message handler, although the handler can use the incoming message's subject to branch for the actual work.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonMessage(Message msg)Called to deliver a message to the handler.
-
-
-
Method Detail
-
onMessage
void onMessage(Message msg) throws java.lang.InterruptedException
Called to deliver a message to the handler. This call is in the dispatcher's thread and can block all other messages being delivered.The thread used to call onMessage will be interrupted if the connection is closed, or the dispatcher is stopped.
- Parameters:
msg- the received Message- Throws:
java.lang.InterruptedException- if the dispatcher interrupts this handler
-
-