static AMQP_VALUE on_message_received(const void* context, MESSAGE_HANDLE message) { (void)message; (void)context; printf("Message received.\r\n"); return messaging_delivery_accepted(); }
static AMQP_VALUE on_message_received(const void* context, MESSAGE_HANDLE message) { (void)context; (void)message; if ((count_received % 1000) == 0) { printf("Messages received : %u.\r\n", (unsigned int)count_received); } count_received++; return messaging_delivery_accepted(); }
static AMQP_VALUE on_message_received(const void* context, MESSAGE_HANDLE message) { AMQP_MANAGEMENT_INSTANCE* amqp_management_instance = (AMQP_MANAGEMENT_INSTANCE*)context; AMQP_VALUE application_properties; if (message_get_application_properties(message, &application_properties) != 0) { /* error */ } else { PROPERTIES_HANDLE response_properties; if (message_get_properties(message, &response_properties) != 0) { /* error */ } else { AMQP_VALUE key; AMQP_VALUE value; AMQP_VALUE map; AMQP_VALUE correlation_id_value; if (properties_get_correlation_id(response_properties, &correlation_id_value) != 0) { /* error */ } else { map = amqpvalue_get_inplace_described_value(application_properties); if (map == NULL) { /* error */ } else { key = amqpvalue_create_string("status-code"); if (key == NULL) { /* error */ } else { value = amqpvalue_get_map_value(map, key); if (value == NULL) { /* error */ } else { int32_t status_code; if (amqpvalue_get_int(value, &status_code) != 0) { /* error */ } else { size_t i = 0; while (i < amqp_management_instance->operation_message_count) { if (amqp_management_instance->operation_messages[i]->operation_state == OPERATION_STATE_AWAIT_REPLY) { AMQP_VALUE expected_message_id = amqpvalue_create_ulong(amqp_management_instance->operation_messages[i]->message_id); OPERATION_RESULT operation_result; if (expected_message_id == NULL) { break; } else { if (amqpvalue_are_equal(correlation_id_value, expected_message_id)) { /* 202 is not mentioned in the draft in any way, this is a workaround for an EH bug for now */ if ((status_code != 200) && (status_code != 202)) { operation_result = OPERATION_RESULT_OPERATION_FAILED; } else { operation_result = OPERATION_RESULT_OK; } amqp_management_instance->operation_messages[i]->on_operation_complete(amqp_management_instance->operation_messages[i]->callback_context, operation_result, 0, NULL); remove_operation_message_by_index(amqp_management_instance, i); amqpvalue_destroy(expected_message_id); break; } amqpvalue_destroy(expected_message_id); } } } } amqpvalue_destroy(value); } amqpvalue_destroy(key); } } } properties_destroy(response_properties); } application_properties_destroy(application_properties); } return messaging_delivery_accepted(); }