Before you can send a message via the Message Bus, you must first create it. Here’s how to create a message:
-
Call the
Message
constructor to create a newMessage
:Message message = new Message();
-
Populate the message with a
String
orObject
payload:-
String payload:
message.setPayload("Message Bus is great!")
-
Object payload:
message.put("firstName", "Joe")
-
-
To receive responses at a particular location, set both of these attributes:
-
Response destination name:
setResponseDestinationName(String)
-
Response ID:
setResponseId(String)
-