Fix async prefix in examples

Summary: related to T15996

Reviewers: iljazovic

Reviewed By: iljazovic

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D33773
This commit is contained in:
Korina Šimičević
2025-02-17 12:31:40 +01:00
parent 40ad372736
commit 684277dc40
12 changed files with 23 additions and 23 deletions

View File

@ -30,7 +30,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
// client_type with logging enabled
@ -59,7 +59,7 @@ boost::asio::awaitable<void> publish_hello_world(
.async_run(boost::asio::detached); // Start the Client.
auto&& [ec, rc, puback_props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
"async-mqtt5/test" /* topic */, "Hello world!" /* payload*/, boost::mqtt5::retain_e::no,
"boost-mqtt5/test" /* topic */, "Hello world!" /* payload*/, boost::mqtt5::retain_e::no,
boost::mqtt5::publish_props {}, use_nothrow_awaitable);
co_await client.async_disconnect(use_nothrow_awaitable);

View File

@ -27,7 +27,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
int main(int argc, char** argv) {
@ -78,7 +78,7 @@ int main(int argc, char** argv) {
assert(strand.running_in_this_thread());
client.async_publish<boost::mqtt5::qos_e::at_least_once>(
"async-mqtt5/test", "Hello World!", boost::mqtt5::retain_e::no,
"boost-mqtt5/test", "Hello World!", boost::mqtt5::retain_e::no,
boost::mqtt5::publish_props {},
// You may bind the strand to this handler, but it is not necessary
// as the strand is already the default associated handler.

View File

@ -20,7 +20,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883; // 1883 is the default TCP MQTT port.
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
int main(int argc, char** argv) {
@ -53,7 +53,7 @@ int main(int argc, char** argv) {
//[publish_hello_world
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
"async-mqtt5/test", "Hello world!",
"boost-mqtt5/test", "Hello world!",
boost::mqtt5::retain_e::yes, boost::mqtt5::publish_props {},
[&client](boost::mqtt5::error_code ec) {
std::cout << ec.message() << std::endl;

View File

@ -22,7 +22,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 8883; // 8883 is the default TLS MQTT port.
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
// External customization point.
@ -89,7 +89,7 @@ int main(int argc, char** argv) {
.async_run(boost::asio::detached); // Start the Client.
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
"async-mqtt5/test", "Hello world!",
"boost-mqtt5/test", "Hello world!",
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props{},
[&client](boost::mqtt5::error_code ec) {
std::cout << ec.message() << std::endl;

View File

@ -22,7 +22,7 @@
struct config {
std::string brokers = "broker.hivemq.com/mqtt"; // Path example: localhost/mqtt
uint16_t port = 8000; // 8083 is the default Webscoket/TCP MQTT port. However, HiveMQ's public broker uses 8000 instead.
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
int main(int argc, char** argv) {
@ -52,7 +52,7 @@ int main(int argc, char** argv) {
.async_run(boost::asio::detached); // Start the Client.
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
"async-mqtt5/test", "Hello world!",
"boost-mqtt5/test", "Hello world!",
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {},
[&client](boost::mqtt5::error_code ec) {
std::cout << ec.message() << std::endl;

View File

@ -23,7 +23,7 @@
struct config {
std::string brokers = "broker.hivemq.com/mqtt"; // Path example: localhost/mqtt
uint16_t port = 8884; // 8884 is the default Websocket/TLS MQTT port.
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
// External customization point.
@ -88,7 +88,7 @@ int main(int argc, char** argv) {
.async_run(boost::asio::detached); // Start the Client.
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
"async-mqtt5/test", "Hello world!",
"boost-mqtt5/test", "Hello world!",
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props{},
[&client](boost::mqtt5::error_code ec) {
std::cout << ec.message() << std::endl;

View File

@ -22,7 +22,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
int main(int argc, char** argv) {
@ -50,7 +50,7 @@ int main(int argc, char** argv) {
// of the previous async_publish call to be invoked.
for (auto i = 1; i <= 5; ++i)
client.async_publish<boost::mqtt5::qos_e::exactly_once>(
"async-mqtt5/test", "Hello world!",
"boost-mqtt5/test", "Hello world!",
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {},
[i](boost::mqtt5::error_code ec, boost::mqtt5::reason_code rc, boost::mqtt5::pubcomp_props) {
std::cout << "Publish number " << i << " completed with: " << std::endl;

View File

@ -31,7 +31,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
// Modified completion token that will prevent co_await from throwing exceptions.
@ -65,7 +65,7 @@ boost::asio::awaitable<void> publish_sensor_readings(
// Publish the sensor reading with QoS 1.
auto&& [ec, rc, props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
"async-mqtt5/test" /* topic */, reading /* payload */,
"boost-mqtt5/test" /* topic */, reading /* payload */,
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {}, use_nothrow_awaitable
);
// An error can occur as a result of:

View File

@ -29,7 +29,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
// Modified completion token that will prevent co_await from throwing exceptions.

View File

@ -32,7 +32,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
// Modified completion token that will prevent co_await from throwing exceptions.
@ -54,7 +54,7 @@ boost::asio::awaitable<void> send_over_mqtt(
.async_run(boost::asio::detached); // Start the Client.
auto&& [pec, prc, puback_props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
"async-mqtt5/test", "Hello World!",
"boost-mqtt5/test", "Hello World!",
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {},
use_nothrow_awaitable
);

View File

@ -27,7 +27,7 @@
struct config {
std::string brokers = "broker.hivemq.com";
uint16_t port = 1883;
std::string client_id = "async_mqtt5_tester";
std::string client_id = "boost_mqtt5_tester";
};
int main(int argc, char** argv) {

View File

@ -40,9 +40,9 @@ using stream_type = asio::ip::tcp::socket;
constexpr auto broker = "broker.hivemq.com";
constexpr auto connect_wait_dur = std::chrono::milliseconds(200);
constexpr auto topic = "async-mqtt5/test";
constexpr auto share_topic = "$share/sharename/async-mqtt5/test";
constexpr auto payload = "hello from async-mqtt5";
constexpr auto topic = "boost-mqtt5/test";
constexpr auto share_topic = "$share/sharename/boost-mqtt5/test";
constexpr auto payload = "hello from boost-mqtt5";
template <typename TestCase>
void run_test(TestCase&& test_case) {