You probably want to check the result of
amqp_confirm_select() and error-handle appropriately.
Assuming you get an AMQP_STATUS_OK from amqp_simple_wait_frame() you need to examine decoded frame (note that this is example code that I've written in my email client - no idea if it compiles or not, also you'll need to decide what what appropriate error-handling will look like for your application).
if (decoded_frame.type == AMQP_FRAME_METHOD && decoded_frame.channel == 1) {
/* Message was published with mandatory = true and the message
* wasn't routed to a queue, so the message is returned */
amqp_message_t returned_message;
die_on_amqp_error(amqp_read_message(conn, 1, &returned_message, 0));
/* Do something with returned, free memory when done */
amqp_destroy_message(returned_message);
/* look for the AMQP_BASIC_ACK_METHOD from the broker */
die_on_error(amqp_simple_wait_frame(conn, &decoded_frame));
if (decoded_frame.type != AMQP_FRAME_METHOD || decoded_frame.channel != 1) {
/* something is probably wrong... handle it */
}
}
amqp_basic_ack_t *a = (amqp_basic_ack_t*)decoded_frame.payload.method.decoded;
/* if you've kept a count of the messages you've published on the channel,
* the a->delivery_tag is the message serial being acknowledged.
* if a->multiple != 0, that means all messages up-to-and-including that message
* serial are being acknowledged */
} else {
/* You've received a different method, probably not what you want */
}
}
HTH
-Alan