CommandMessage represents a message payload. It implements a builder (or fluent) API which is used for constructing sendable messages.
Example Message: CommandMessage msg = CommandMessage.create() .toSubject("Foo") .set("Text", "I like chocolate cake.");
You can transmit a message using the the
sendNowWith() method by providing an instance of {@link org.jboss.errai.bus.client.MessageBus}.
Messages can be contructed using user-defined standard protocols through the use of enumerations. Both
commandType and message parts can be defined through the use of enumerations. This helps create strongly-defined protocols for communicating with services. For instance:
public enum LoginParts { Username, Password }
.. and ..
public enum LoginCommands { Login, Logout }
These enumerations can than be directly used to build messages and decode incoming messages by a service. For example:
CommandMessage.create() .command(LoginCommands.Login) .set(LoginParts.Username, "foo") .set(LoginParts.Password, "bar ) .sendNowWith(busInstance);
@see org.jboss.errai.bus.client.ConversationMessage