Class TypedMessage

  • All Implemented Interfaces:

    
    public final class TypedMessage<T extends Object>
    
                        

    A decoded payload with the envelope it arrived in.

    What eu.vstoyanov.natsy.subscribe hands over is the payload alone, which is all most subscribers want. The three things it leaves behind are needed often enough to be worth a type: subject is the only way a wildcard subscriber learns which subject matched, replyTo is what makes answering a request possible, and headers carry whatever the publisher put beside the payload - a trace id, a tenant, a schema version.

    eu.vstoyanov.natsy.subscribeMessages is the same subscription carrying these instead, and eu.vstoyanov.natsy.respond is written on top of it.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      TypedMessage(T payload, String subject, String replyTo, Headers headers)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final T getPayload() the decoded message
      final String getSubject() the subject this message was published to, which for a wildcard or queue subscription is not the subject that was subscribed to
      final String getReplyTo() the subject a reply is expected on, or null for a message that is not a request
      final Headers getHeaders() the headers the message arrived with, or null if it carried none
      • Methods inherited from class java.lang.Object

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

      • TypedMessage

        TypedMessage(T payload, String subject, String replyTo, Headers headers)
    • Method Detail

      • getSubject

         final String getSubject()

        the subject this message was published to, which for a wildcard or queue subscription is not the subject that was subscribed to

      • getReplyTo

         final String getReplyTo()

        the subject a reply is expected on, or null for a message that is not a request

      • getHeaders

         final Headers getHeaders()

        the headers the message arrived with, or null if it carried none