diff --git a/docs/src/reference/docbook/channel.xml b/docs/src/reference/docbook/channel.xml index 1876792ff9..90b9bb8e8e 100644 --- a/docs/src/reference/docbook/channel.xml +++ b/docs/src/reference/docbook/channel.xml @@ -335,7 +335,7 @@ and wait for a reply. MessagingTemplate template = new MessagingTemplate(); -Message reply = template.sendAndReceive(new StringMessage("test"), someChannel); +Message reply = template.sendAndReceive(new GenericMessage("test"), someChannel); In that example, a temporary anonymous channel would be created internally by the template. The 'sendTimeout' and 'receiveTimeout' properties may also be set on the template, and other exchange types are also supported. diff --git a/docs/src/reference/docbook/message.xml b/docs/src/reference/docbook/message.xml index 2129313f02..7312dce3f1 100644 --- a/docs/src/reference/docbook/message.xml +++ b/docs/src/reference/docbook/message.xml @@ -130,16 +130,12 @@ new GenericMessage<T>(T payload, Map<String, Object> headers) - There are also two convenient subclasses available: StringMessage and - ErrorMessage. The former accepts a String as its payload: - StringMessage message = new StringMessage("hello world"); - -String s = message.getPayload(); - And, the latter accepts any Throwable object as its payload: + There is also a convenient implementation of Message designed to communicate + error conditions. THis implementation takes Throwable object as its payload: ErrorMessage message = new ErrorMessage(someThrowable); Throwable t = message.getPayload(); - Notice that these implementations take advantage of the fact that the GenericMessage + Notice that this implementation takes advantage of the fact that the GenericMessage base class is parameterized. Therefore, as shown in both examples, no casting is necessary when retrieving the Message payload Object.