class_docstr: Queue enables polling for received or sent messages.
  
  This class assumes a single consumer of the queue (concurrent calls to
  `get_messages_nowait` and `wait_for_message` is undefined behavior).
  
  This class implements the ASGI `Send` interface.
docstr: Returns all messages that are currently available (non-blocking).
  
  At least one message will be present if `wait_for_message` had previously
  returned and a subsequent call to `wait_for_message` blocks until at
  least one new message is available.
docstr_tok: ["Returns","all","messages","that","are","currently","available","(","non-blocking",")",".","At","least","one","message","will","be","present","if","`","wait_for_message","`","had","previously","returned","and","a","subsequent","call","to","`","wait_for_message","`","blocks","until","at","least","one","new","message","is","available","."]
code: def get_messages_nowait(self) -> List[Message]:
      """Returns all messages that are currently available (non-blocking).
  
      At least one message will be present if `wait_for_message` had previously
      returned and a subsequent call to `wait_for_message` blocks until at
      least one new message is available.
      """
      messages = []
      while not self._message_queue.empty():
          messages.append(self._message_queue.get_nowait())
  
      self._new_message_event.clear()
      return messages
  
imports: import asyncio
  import inspect
  import json
  import logging
  import pickle
  import socket
  from dataclasses import dataclass
  from typing import Any, List, Optional, Tuple, Type
  import starlette
  from fastapi.encoders import jsonable_encoder
  from starlette.types import ASGIApp, Message, Receive, Scope, Send
  from uvicorn.config import Config
  from uvicorn.lifespan.on import LifespanOn
  from ray._private.pydantic_compat import IS_PYDANTIC_2
  from ray.actor import ActorHandle
  from ray.serve._private.constants import SERVE_LOGGER_NAME
  from ray.serve._private.utils import serve_encoders
  from ray.serve.exceptions import RayServeException
label_desc: Use image node_id 3 for calling the MessageQueue obj's underlying member method code with example usage: obj.get_messages_nowait() and returns: messages