Function amqp_simple_rpc_decoded

Synopsis

#include <librabbitmq/amqp.h>

void * amqp_simple_rpc_decoded(amqp_connection_state_t state, amqp_channel_t channel, amqp_method_number_t request_id, amqp_method_number_t reply_id, void *decoded_request_method)

Description

Sends a method to the broker and waits for a method response

Parameters:

[ in ] state - the connection object

[ in ] channel - the channel object

[ in ] request_id - the method number of the request

[ in ] reply_id - the method number expected in response

[ in ] decoded_request_method - the request method

Return
a pointer to the method returned from the broker, or NULL on error. On error amqp_get_rpc_reply() will return an amqp_rpc_reply_t with details on the error that occurred.
Since
v0.1

Source

Lines 1139-1165 in librabbitmq/amqp_socket.c. Line 1685 in librabbitmq/amqp.h.

void *amqp_simple_rpc_decoded(amqp_connection_state_t state,
                              amqp_channel_t channel,
                              amqp_method_number_t request_id,
                              amqp_method_number_t reply_id,
                              void *decoded_request_method) {
  amqp_time_t deadline;
  int res;
  amqp_method_number_t replies[2];

  res = amqp_time_from_now(&deadline, state->rpc_timeout);
  if (res != AMQP_STATUS_OK) {
    state->most_recent_api_result = amqp_rpc_reply_error(res);
    return NULL;
  }

  replies[0] = reply_id;
  replies[1] = 0;

  state->most_recent_api_result = simple_rpc_inner(
      state, channel, request_id, replies, decoded_request_method, deadline);

  if (state->most_recent_api_result.reply_type == AMQP_RESPONSE_NORMAL) {
    return state->most_recent_api_result.reply.decoded;
  } else {
    return NULL;
  }
}





Add Discussion as Guest

Log in to DocsForge