Package com.tccc.kos.commons.core.broker
Class MessageData
java.lang.Object
com.tccc.kos.commons.core.broker.MessageData
A
MessageBroker
message forwarded to a subscriber, typically via the
MessageBrokerCallback
interface.
Messages are routed through the broker based on the topic of the message, which is a filesystem path style string. As topics are inherently hierarchical, it is possible to subscribe to a sub-topic using a wildcard to receive all child topics. When using wildcards, the message topic does not necessarily match the subscription topic so both are included as properties:
topic
: The topic the sender used to send the message.subscription
: The topic that was used during the subscribe call.
jsonBody
property. If the subscribe call included
a java POJO class then the body
will contain an instance of the specified
class, deserialized from jsonBody
.
Example
public class MyClass {
@Autowired
private MessageBroker broker;
...
broker.subscribe(mySession, "/topic/goes/here", Pojo.class, (msg) -> {
Pojo body = msg.getBody();
}
}
- Since:
- 1.0
- Version:
- 2022-09-28
- See Also:
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBody()
getTopic()
int
hashCode()
void
void
setJsonBody
(JsonNode jsonBody) void
setSession
(Object session) void
setSubscription
(String subscription) void
toString()
-
Constructor Details
-
MessageData
public MessageData() -
MessageData
-
-
Method Details