With the Message Broker API, you can send, receive, and consume messages from a Message Broker.
After receiving a message, the consumer decides what to do with the message. If the processing was successful, the decision can be to delete the message from the queue. Otherwise, depending on other factors, the decision could be that the message has to go into the dead letter queue, defer the processing, etc.
Check this documentation about message settlement.
Message settlement with peek lock mode