How to implement publisher confirms in rabbitmq-c? In an example written by alanxz this is the approach:
amqp_frame_t frame;
amqp_simple_wait_frame(conn, &frame);
if (frame.method == AMQP_BASIC_ACK)
{
// Message successfully delivered
}
https://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-July/021338.html
However it appears that amqp_frame_t
structure has no member method
anymore. This is the error that I am getting:
error: ‘amqp_frame_t’ {aka ‘struct amqp_frame_t_’} has no member named ‘method’
I looked up the documentation for amqp_frame_t
, this is how the data structure is:
typedef struct amqp_frame_t_ {
uint8_t frame_type; /* 0 means no event */
amqp_channel_t channel;
union {
amqp_method_t method;
struct {
uint16_t class_id;
uint64_t body_size;
void *decoded;
} properties;
amqp_bytes_t body_fragment;
struct {
uint8_t transport_high;
uint8_t transport_low;
uint8_t protocol_version_major;
uint8_t protocol_version_minor;
} protocol_header;
} payload;
} amqp_frame_t;
I am trying to write a function:
void publisher_confirm(amqp_connection_state_t conn){
amqp_frame_t frame;
frame.frame_type == AMQP_FRAME_METHOD;
amqp_simple_wait_frame(conn, &frame);
//if (frame.payload.method == AMQP_BASIC_ACK)
//Suppose we could compare some member of the method structure with some value
{
printf("Message successfully delivered to queue.\n");
}
}
However I don't know how to perform the comparison for frame.payload.method
. frame.payload.method
is of the type amqp_method_t
which is documented here:
http://alanxz.github.io/rabbitmq-c/docs/0.2/structamqp__method__t.html#a83e7496e9cc6d407d5798345a0c07504