DAS_2023_1/alexandrov_dmitrii_lab_4/consumer_slow/mainwindow.cpp

34 lines
756 B
C++

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QUuid>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ClientOption clOpt;
ConsumeOption conOpt;
conOpt.exchange = "publisher";
conOpt.bindingKeys << "all";
conOpt.queueOption.name = "queue_slow";
conOpt.queueOption.auto_delete = true;
receiver = new Receiver(clOpt, conOpt);
QObject::connect(receiver, &Receiver::onMessage, this, [&](ProduceMessage msg, uint64_t consumeTag) {
Q_UNUSED(consumeTag)
QString msg_body = "got " + QString::fromLocal8Bit(msg.getBodyMsg());
ui->listWidget->addItem(msg_body);
});
}
MainWindow::~MainWindow()
{
delete ui;
}