[ 
https://issues.apache.org/jira/browse/AMQ-8464?focusedWorklogId=992504&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-992504
 ]

ASF GitHub Bot logged work on AMQ-8464:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Nov/25 20:38
            Start Date: 19/Nov/25 20:38
    Worklog Time Spent: 10m 
      Work Description: 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.
   > 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 992504)
    Time Spent: 2.5h  (was: 2h 20m)

> Implement JMS 2.0 Consumer receiveBody
> --------------------------------------
>
>                 Key: AMQ-8464
>                 URL: https://issues.apache.org/jira/browse/AMQ-8464
>             Project: ActiveMQ Classic
>          Issue Type: New Feature
>            Reporter: Matt Pavlovich
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>              Labels: #jms2
>             Fix For: 6.3.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to