docs: public synchronized void consumeMessages(LockedMessageEnumeration lme) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.entry(this, tc, "consumeMessages", lme);
  
          Integer highestPriority = Integer.valueOf(0);
          int messageCount = 0;
          Integer currentPriority;
          SIBusMessage jsMessage = null;
  
          // First go through each message and find out what the
          // highest priority is. All messages will be sent to the
          // client at this priority.
          while (true) {
              try {
                  jsMessage = lme.nextLocked();
                  if (jsMessage == null) {
                      // We have run out of messages, so reset the cursor
                      // and get out of here.
                      lme.resetCursor();
                      break;
                  }
  
                  // Count the messages so that when sending them to the client
                  // we know which one is the 'last in batch'
                  messageCount++;
  
                  // Get the priority
                  currentPriority = jsMessage.getPriority();
                  if (currentPriority.intValue() > highestPriority.intValue()) {
                      highestPriority = currentPriority;
                  }
  
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      SibTr.debug(this, tc, "Message " + jsMessage.getMessageHandle() +
                                                       " has priority " + currentPriority);
              } catch (SIException e) {
                  //No FFDC code needed
                  //Only FFDC if we haven't received a meTerminated event.
                  if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
                      FFDCFilter.processException(e,
                                                  CLASS_NAME + ".consumeMessages",
                                                  CommsConstants.CATASYNCHCONSUMER_CONSUME_MSGS_01,
                                                  this);
                  }
  
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      SibTr.debug(this, tc, e.getMessage(), e);
  
                  StaticCATHelper.sendAsyncExceptionToClient(e,
                                                             CommsConstants.CATASYNCHCONSUMER_CONSUME_MSGS_01, // d186970
                                                             getClientSessionId(), getConversation(), 0);
  
                  // Attempt to resetCursor so we can atleast send some of the messages, this is likely to fail 
                  //  as the most likely reason we are here is because of a closed connection/session, but it is
                  //  worth trying this.
                  try {
                      lme.resetCursor();
                  } catch (SIException e1) {
                      // No FFDC Code needed
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          SibTr.debug(this, tc, e1.getMessage(), e1);
                  }
                  //Break out of the loop as there was an issue with nextLocked or resetCursor. 
                  break;
              }
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              SibTr.debug(this, tc, "There are " + messageCount + " messages in the LME");
              SibTr.debug(this, tc, "The highest message priority is " + highestPriority);
          }
  
          String xctErrStr = null;
          boolean ok = true;
  
          for (int currMessCount = 0; currMessCount < messageCount; currMessCount++) {
              // If we failed to send a message, don't try anymore
              if (!ok)
                  break;
  
              try {
                  jsMessage = lme.nextLocked();
  //                if (XctSettings.isAnyEnabled()) {
  //                    String xctCorrelationID = jsMessage.getXctCorrelationID();
  //                    Xct xct = Xct.fromString(xctCorrelationID);
  //                    if (xct.annotationsEnabled()) {
  //                        Annotation annotation = new Annotation(XctJmsConstants.XCT_SIBUS).add(XctJmsConstants.XCT_CONSUME_SEND);
  //                        annotation.add(new Annotation(XctJmsConstants.XCT_SYSTEM_MESSAGE_ID).add(jsMessage.getSystemMessageId()));
  //                        xct.begin(annotation);
  //                    } else
  //                        xct.begin();
  //                }
  
                  // Are we the last in batch?
                  if ((currMessCount + 1) == messageCount) {
                      // Stop the session
                      getConsumerSession().stop();
                      started = false;
                      batchesSent++;
                      messagesSent++;
  
                      ok = sendMessage(jsMessage, true, highestPriority);
                  } else {
                      ok = sendMessage(jsMessage, false, highestPriority);
                      messagesSent++;
                  }
  
                  // If the message is 'unrecoverable', then delete it immediately
                  if (!CommsUtils.isRecoverable(jsMessage, mainConsumer.getUnrecoverableReliability())) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          SibTr.debug(this, tc, "Deleting message");
                      lme.deleteCurrent(null);
                  }
              } catch (Exception e) {
                  //No FFDC code needed
  
                  //Error string for XCT
                  // Romil liberty changes coomented xct code 
                  //xctErrStr = XctJmsConstants.XCT_ERROR_MSG_06;
  
                  //Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException.
                  if (!(e instanceof SIException) || !((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
                      FFDCFilter.processException(e,
                                                  CLASS_NAME + ".consumeMessages",
                                                  CommsConstants.CATASYNCHCONSUMER_CONSUME_MSGS_02);
                  }
  
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      SibTr.debug(this, tc, e.getMessage(), e);
  
                  StaticCATHelper.sendAsyncExceptionToClient(e,
                                                             CommsConstants.CATASYNCHCONSUMER_CONSUME_MSGS_02,
                                                             getClientSessionId(), getConversation(), 0);
  
                  // Attempt to stop the session before we break out
                  try {
                      getConsumerSession().stop();
                      started = false;
                  } catch (SIException e1) {
                      //No FFDC Code needed
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          SibTr.debug(this, tc, e1.getMessage(), e1);
                  }
  
                  // We are unlikely to be able to move forward through the LME, i.e. nextLocked will always 
                  //  fail. So break out now so we don't flood the system with messages.
                  break;
              } finally {
  //                if (XctSettings.isAnyEnabled()) {
  //                    Xct xct = Xct.current();
  //                    if (xct.annotationsEnabled()) {
  //                        Annotation annotation = new Annotation(XctJmsConstants.XCT_SIBUS).add(XctJmsConstants.XCT_CONSUME_SEND);
  //                        if (xctErrStr != null)
  //                            annotation.add(XctJmsConstants.XCT_FAILED).add(xctErrStr);
  //                        xct.end(annotation);
  //                    } else
  //                        xct.end();
  //                }
              }
          }
  
          // Update the session lowest priority
          mainConsumer.setLowestPriority(JFapChannelConstants.getJFAPPriority(highestPriority));
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
              SibTr.exit(this, tc, "consumeMessages");
      }