web::http::uri generate_queue_message_uri(const web::http::uri& base_uri, const cloud_queue& queue, const cloud_queue_message& message) { if (base_uri.is_empty()) { return web::http::uri(); } web::http::uri_builder builder(base_uri); builder.append_path(queue.name(), /* do_encoding */ true); builder.append_path(U("messages")); builder.append_path(message.id(), /* do_encoding */ true); return builder.to_uri(); }
pplx::task<void> cloud_queue::update_message_async(cloud_queue_message& message, std::chrono::seconds visibility_timeout, bool update_content, queue_request_options& options, operation_context context) { if (message.id().empty()) { throw std::invalid_argument(protocol::error_empty_message_id); } if (message.pop_receipt().empty()) { throw std::invalid_argument(protocol::error_empty_message_pop_receipt); } if (visibility_timeout.count() < 0LL) { throw std::invalid_argument(protocol::error_negative_visibility_timeout); } if (visibility_timeout.count() > 604800LL) { throw std::invalid_argument(protocol::error_large_visibility_timeout); } queue_request_options modified_options = get_modified_options(options); storage_uri uri = protocol::generate_queue_message_uri(service_client(), *this, message); std::shared_ptr<core::storage_command<void>> command = std::make_shared<core::storage_command<void>>(uri); command->set_build_request(std::bind(protocol::update_message, message, visibility_timeout, update_content, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); command->set_authentication_handler(service_client().authentication_handler()); command->set_preprocess_response([&message] (const web::http::http_response& response, const request_result& result, operation_context context) mutable { protocol::preprocess_response_void(response, result, context); message.set_pop_receipt(protocol::parse_pop_receipt(response)); message.set_next_visible_time(protocol::parse_next_visible_time(response)); }); return core::executor<void>::execute_async(command, modified_options, context); }
web::http::uri generate_queue_message_uri(const web::http::uri& base_uri, const cloud_queue& queue, const cloud_queue_message& message) { return generate_queue_message_uri(base_uri, queue, message.id()); }