tabish121 commented on code in PR #1543:
URL: https://github.com/apache/activemq/pull/1543#discussion_r2543503024
##########
activemq-client/src/main/java/org/apache/activemq/ActiveMQConsumer.java:
##########
@@ -100,17 +100,44 @@ public void close() {
@Override
public <T> T receiveBody(Class<T> c) {
- throw new UnsupportedOperationException("receiveBody(Class<T>) is not
supported");
+ Message message = receive();
+ if (message == null) {
+ return null;
+ }
+ try {
+ Object body = message.getBody(c);
+ return c.cast(body);
+ } catch (JMSException e) {
Review Comment:
This would violate the JMS specification in that it does not return the
message to the head of the prefetch queue to be read again on the next receive
call for the AUTO and DUPS_OK ack modes. Same for the other methods below.
> The result of this method throwing a MessageFormatRuntimeException
depends on the session mode:
>
> AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE: The JMS provider will behave
as if the unsuccessful call to receiveBody had not occurred. The message will
be delivered again before any subsequent messages.
>
> This is not considered to be redelivery and does not cause the
JMSRedelivered message header field to be set or the JMSXDeliveryCount message
property to be incremented.
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact