Class Notification


  • public class Notification
    extends java.lang.Object
    A Broker notification is used to handle either synchronous or asynchronous replies from the Broker. Register a notification with a reply queue and you will be notified when a reply matching the notification's request ID is posted to the reply queue. Notification can either be synchronous by listening to the notification or asynchronous by creating a notification with a callback.
    • Constructor Summary

      Constructors 
      Constructor Description
      Notification​(int requestID)
      Create a synchronous notification request.
      Notification​(int requestID, ReplyCb cb)
      Create an asynchronous notification request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ReplyCb getCb()
      Get the notification's callback.
      Reply getReply()
      Get the notification's reply.
      int getRequestID()
      Get the notification's request ID.
      void register​(ReplyQueue queue)
      Register the notification with a Broker reply queue.
      void setReply​(Reply reply)
      Set the notification's reply.
      java.lang.String toString()
      Returns a string representation of the object.
      void unregister()
      Unregister a notification request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Notification

        public Notification​(int requestID)
        Create a synchronous notification request.
        Parameters:
        requestID - the request ID of the notification
      • Notification

        public Notification​(int requestID,
                            ReplyCb cb)
        Create an asynchronous notification request.
        Parameters:
        requestID - the request ID of the notification
        cb - the notification's callback
    • Method Detail

      • getRequestID

        public int getRequestID()
        Get the notification's request ID.
        Returns:
        the notification's request ID
      • setReply

        public void setReply​(Reply reply)
        Set the notification's reply.
        Parameters:
        reply - the reply to set
      • getReply

        public Reply getReply()
        Get the notification's reply.
        Returns:
        the notification's reply
      • getCb

        public ReplyCb getCb()
        Get the notification's callback.
        Returns:
        the notification's callback
      • register

        public void register​(ReplyQueue queue)
        Register the notification with a Broker reply queue. The notification will be notified when a Broker reply whose request ID matches the notification's request ID is posted to the reply queue.
        Parameters:
        queue - the reply queue to register the notification with
      • unregister

        public void unregister()
        Unregister a notification request.
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the object