In message brokers, queues act as buffers holding messages sent by producers until consumers process them. The flow starts with a producer sending a message to the queue. The queue stores messages in order. Consumers receive messages from the queue but do not remove them immediately. They process the message and then send an acknowledgment. Only after acknowledgment does the queue remove the message. This mechanism ensures messages are not lost if a consumer fails before processing. The queue state changes as messages are added, taken for processing, and removed after acknowledgment. Tracking these states helps understand message flow and reliability in distributed systems.