Skip to main content

basic_get

Retrieves a single message from a specified AMQP queue and outputs the result, handling reconnections if the channel is unavailable or an error occurs.

def basic_get(
amqp_context: object,
queue: string,
no_ack: boolean = False
) - > null

Fetches a single message from a specified queue on the AMQP broker. This function is used to manually poll for messages and will attempt to reconnect to the broker if the channel is unavailable or an error occurs during retrieval.

Parameters

NameTypeDescription
amqp_contextobjectThe context object containing the active AMQP channel, connection state, and output methods.
queuestringThe name of the AMQP queue from which to retrieve the message.
no_ackboolean = FalseIf set to True, the broker will consider the message acknowledged immediately upon delivery; if False, the client must send an explicit acknowledgement later.

Returns

TypeDescription
nullReturns nothing directly; outputs the dumped message content and a success status to the context's response handler.