Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.client.api.base
Class ConversationMessage

java.lang.Object
  extended by org.jboss.errai.bus.client.api.base.CommandMessage
      extended by org.jboss.errai.bus.client.api.base.ConversationMessage
All Implemented Interfaces:
Message

public class ConversationMessage
extends CommandMessage

A message that is automatically routed back to the originating bus of a reference message (usually called the incoming message). When a ConversationMessage is dispatched, it will only be delivered to the bus that the incoming message originated from.

 public class SomeService implements MessageCallback {
   public void callback(CommandMessage message) {
     ConversationMessage.create(message) // create a ConversationMessage that
                                         // references the incoming message
             .setSubject("ClientService") // specify the service on the sending
                                          // bus that should receive the message
             .set("Text", "Hello, World!").sendNowWith(messageBusInstance); // send
                                                                            // the
                                                                            // message
   }
 }
 

It is possible for a message sender to specify a ReplyTo message component, which by default will be used to route the message. We refer to this as a sender-driven conversation as opposed to a receiver-driven conversation which is demonstrated in the code example above.


Method Summary
static ConversationMessage create(Enum<?> commandType, Message inReplyTo)
          Creates a new ConversationMessage with the specified command type and reference message.
static ConversationMessage create(Message inReplyTo)
          Creates a new ConversationMessage using an incoming message as a reference.
static ConversationMessage create(String commandType, Message inReplyTo)
          Creates a new ConversationMessage with the specified command type and reference message.
 
Methods inherited from class org.jboss.errai.bus.client.api.base.CommandMessage
addAllParts, addAllProvidedParts, addResources, command, command, commit, copy, copy, copyResource, create, createWithParts, createWithParts, createWithParts, createWithPartsFromRawMap, errorsCall, get, get, getCommandType, getErrorCallback, getParts, getProvidedParts, getResource, getSubject, getValue, hasPart, hasPart, hasResource, isCommited, isFlagSet, remove, remove, sendNowWith, sendNowWith, set, set, setFlag, setParts, setProvidedPart, setProvidedPart, setResource, toString, toSubject, unsetFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static ConversationMessage create(Message inReplyTo)
Creates a new ConversationMessage using an incoming message as a reference.

Parameters:
inReplyTo - the incoming message.
Returns:
a ConversationMessage that will be routed to the MessageBus that sent the inReplyTo message.

create

public static ConversationMessage create(Enum<?> commandType,
                                         Message inReplyTo)
Creates a new ConversationMessage with the specified command type and reference message.

Parameters:
commandType - The command type for this message. Command is an optional extension for creating services that can respond to different specific commands. Must not be null.
inReplyTo - the incoming message. Must not be null.

create

public static ConversationMessage create(String commandType,
                                         Message inReplyTo)
Creates a new ConversationMessage with the specified command type and reference message.

Parameters:
commandType - The command type for this message. Command is an optional extension for creating services that can respond to different specific commands. Must not be null.
inReplyTo - the incoming message. Must not be null.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.