Package io.adamantic.quicknote.types
Class Message
java.lang.Object
io.adamantic.quicknote.types.Message
Simple representation of a message to be sent over a channel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA very basic message id generator. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessage(long id) Creates a new message with a specific id, rather than asking the ID generator to generate a new one. -
Method Summary
-
Field Details
-
DEFAULT_ROUTING
Default routing key for messages.- See Also:
-
DEFAULT_CONTENT_TYPE
Default content type for messages.- See Also:
-
DEFAULT_HEADERS
Default headers for messages. -
DEFAULT_PAYLOAD
public static final byte[] DEFAULT_PAYLOADDefault payload for messages. -
DEFAULT_TTL
public static final int DEFAULT_TTLDefault time-to-live for messages.- See Also:
-
-
Constructor Details
-
Message
public Message(long id) Creates a new message with a specific id, rather than asking the ID generator to generate a new one. Especially useful for incominc messages, where the id is already generated by the sender.- Parameters:
id- the message id
-
-
Method Details
-
touchTtl
public int touchTtl()Decrements the time to live of this message. If the time to live reaches zero, aTimeToLiveExpiredexception is thrown (unchecked).- Returns:
- the updated time to live
-
nextId
public static long nextId()Delegates message id generation to the installed id generator.- Returns:
- the next message id
-