Class Message
- java.lang.Object
-
- com.smartgridready.driver.api.messaging.model.Message
-
public class Message extends java.lang.Object
Represents a message conveyed by messaging clients.
-
-
Constructor Summary
Constructors Constructor Description Message(java.lang.String key, java.lang.String payload)
Constructor using an optional message key and the message payload.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getKey()
Gets the message key.java.lang.String
getPayload()
Gets the message payload.static Message
of(java.lang.String payload)
Factory method for a message that has a payload only.static Message
of(java.lang.String key, java.lang.String payload)
Factory method for a message with payload and an additional message key.
-
-
-
Method Detail
-
getKey
public java.lang.String getKey()
Gets the message key.- Returns:
- The optional message key, may return
null
-
getPayload
public java.lang.String getPayload()
Gets the message payload.- Returns:
- The message payload
-
of
public static Message of(java.lang.String payload)
Factory method for a message that has a payload only.- Parameters:
payload
- The payload- Returns:
- A new instance of
Message
-
-