@@ -456,7 +456,12 @@ int main(int argc, char *argv[])
456456 connection->OnConnectionInterrupted = std::move (onInterrupted);
457457 connection->OnConnectionResumed = std::move (onResumed);
458458
459- connection->SetOnMessageHandler ([](Mqtt::MqttConnection &, const String &topic, const ByteBuf &payload) {
459+ connection->SetOnMessageHandler ([](Mqtt::MqttConnection &,
460+ const String &topic,
461+ const ByteBuf &payload,
462+ bool /* dup*/ ,
463+ Mqtt::QOS /* qos*/ ,
464+ bool /* retain*/ ) {
460465 fprintf (stdout, " Generic Publish received on topic %s, payload:\n " , topic.c_str ());
461466 fwrite (payload.buffer , 1 , payload.len , stdout);
462467 fprintf (stdout, " \n " );
@@ -479,7 +484,12 @@ int main(int argc, char *argv[])
479484 /*
480485 * This is invoked upon the receipt of a Publish on a subscribed topic.
481486 */
482- auto onPublish = [&](Mqtt::MqttConnection &, const String &topic, const ByteBuf &byteBuf) {
487+ auto onMessage = [&](Mqtt::MqttConnection &,
488+ const String &topic,
489+ const ByteBuf &byteBuf,
490+ bool /* dup*/ ,
491+ Mqtt::QOS /* qos*/ ,
492+ bool /* retain*/ ) {
483493 fprintf (stdout, " Publish received on topic %s\n " , topic.c_str ());
484494 fprintf (stdout, " \n Message:\n " );
485495 fwrite (byteBuf.buffer , 1 , byteBuf.len , stdout);
@@ -512,7 +522,7 @@ int main(int argc, char *argv[])
512522 subscribeFinishedPromise.set_value ();
513523 };
514524
515- connection->Subscribe (topic.c_str (), AWS_MQTT_QOS_AT_LEAST_ONCE, onPublish , onSubAck);
525+ connection->Subscribe (topic.c_str (), AWS_MQTT_QOS_AT_LEAST_ONCE, onMessage , onSubAck);
516526 subscribeFinishedPromise.get_future ().wait ();
517527
518528 while (true )
0 commit comments