Interface Message


  • public interface Message
    The NATS library uses a Message object to encapsulate incoming messages. Applications publish and send requests with raw strings and byte[] but incoming messages can have a few values, so they need a wrapper.

    The byte[] returned by getData() is not shared with any library code and is safe to manipulate.

    • Method Detail

      • getSubject

        java.lang.String getSubject()
        Returns:
        the subject that this message was sent to
      • getReplyTo

        java.lang.String getReplyTo()
        Returns:
        the subject the application is expected to send a reply message on
      • getData

        byte[] getData()
        Returns:
        the data from the message
      • getSubscription

        Subscription getSubscription()
        Returns:
        the Subscription associated with this message, may be owned by a Dispatcher
      • getSID

        java.lang.String getSID()
        Returns:
        the id associated with the subscription, used in the
      • getConnection

        Connection getConnection()
        Returns:
        the connection which can be used for publishing, will be null if the subscription is null