code: protected void setMessageListener(MessageListener messageListener) {
          this.messageListener = messageListener;
          if (messageListener == null || isClosed()) {
              return;
          }
          synchronized (stateLock) {
              if (!running || isClosed()) {
                  return;
              }
              
              List<MessageManager> allPrefetchedMessages = new ArrayList<MessageManager>(messageQueue);
              sqsSessionRunnable.scheduleCallBacks(messageListener, allPrefetchedMessages);
              messageQueue.clear();
  
              // This will request the first message if necessary.
              // TODO: This may overfetch if setMessageListener is being called multiple
              // times, as the session callback scheduler may already have entries for this consumer.
              messageListenerReady();
          }
      }
docs: Sets the message listener.
  <P>
  If message listener is set, the existing messages on the internal buffer
  will be pushed to session callback scheduler.
  <P>
  If message lister is set to null, then the messages on the internal
  buffer of session callback scheduler will be negative acknowledged, which
  will be handled by the session callback scheduler thread itself.