users@jms-spec.java.net

[jms-spec users] Re: [jsr343-experts] (JMS_SPEC-102) Make JMSConsumer.receivePayload methods consistent with Message.getBody

From: Oleg Tsal-Tsalko <oleg.tsalko_at_gmail.com>
Date: Fri, 26 Oct 2012 23:11:52 +0300

Hi Nigel,

In addition, the name of these method should be changed to
> receiveBody(Class<T> c), receiveBody(Class<T> c, long
> timeout) and receiveBodyNoWait(Class<T> c) since the word "payload" is
> inconsistent with the term "body" which is
> used in JMS 1.1.


It is probably ok to have Message#getBody(Class<T> c) method, cause it is
essential that Message has a body and a header and it is ok to say
message.getBody().

However receivePayload(Class<T> c), receivePayload(Class<T> c, long
timeout) and receivePayloadNoWait(Class<T> c) methods I think are more
suitable for Consumer.
Cause it sounds more natural consumer.getPayload(), than
consumer.getBody(). It appeared question in my head - whose body I'm
receiving:))?

What other guys think?

Thank you,
Oleg

2012/10/26 Nigel Deakin <nigel.deakin_at_oracle.com>

> I have logged this JIRA issue:
> http://java.net/jira/browse/**JMS_SPEC-102<http://java.net/jira/browse/JMS_SPEC-102>
> Make JMSConsumer.receivePayload methods consistent with Message.getBody
>
> JMS_SPEC_64 introduced a new interface JMSConsumer for JMS 2.0. This has
> methods receivePayload(Class<T> c),
> receivePayload(Class<T> c, long timeout) and receivePayloadNoWait(Class<T>
> c).
>
> JMS_SPEC-101 will introduce a new method getBody(Class<T> c).
>
> If JMS_SPEC-101 is agreed then the definition of receivePayload(Class<T>
> c), receivePayload(Class<T> c, long
> timeout) and receivePayloadNoWait(Class<T> c) should be amended to make it
> consistent with the definition of
> getBody(Class<T> c). Specifically, these methods should allow the
> specified class to be any type to which the
> message payload can be assigned.
>
> In addition, the name of these method should be changed to
> receiveBody(Class<T> c), receiveBody(Class<T> c, long
> timeout) and receiveBodyNoWait(Class<T> c) since the word "payload" is
> inconsistent with the term "body" which is
> used in JMS 1.1.
>
> I will wait until JMS_SPEC-101 is resolved. Then I will make some more
> specific proposals for changes to receivePayload and receivePayloadNoWait
> for you to review.
>
> Nigel
>
>