diff --git a/src/qamqpglobal.h b/src/qamqpglobal.h index 54abf52..922ccd5 100644 --- a/src/qamqpglobal.h +++ b/src/qamqpglobal.h @@ -24,10 +24,10 @@ #define AMQP_SSL_SCHEME "amqps" #define AMQP_PORT 5672 #define AMQP_SSL_PORT 5671 -#define AMQP_HOST "localhost" +#define AMQP_HOST "192.168.46.100" #define AMQP_VHOST "/" -#define AMQP_LOGIN "guest" -#define AMQP_PSWD "guest" +#define AMQP_LOGIN "ecl3000" +#define AMQP_PSWD "ecl3000" #define AMQP_FRAME_MAX 131072 #define AMQP_FRAME_MIN_SIZE 4096 diff --git a/tutorials/helloworld/receive/main.cpp b/tutorials/helloworld/receive/main.cpp index 9900502..08eb156 100644 --- a/tutorials/helloworld/receive/main.cpp +++ b/tutorials/helloworld/receive/main.cpp @@ -33,8 +33,22 @@ private Q_SLOTS: return; connect(queue, SIGNAL(messageReceived()), this, SLOT(messageReceived())); - queue->consume(QAmqpQueue::coNoAck); + + // queue->consume(QAmqpQueue::coNoAck); + // queue->consume(QAmqpQueue::coNoLocal); + + qint32 sizeQueue = queue->messageCount(); + while (sizeQueue--) { + queue->get(false); + } + qDebug() << " [*] Waiting for messages. To exit press CTRL+C"; + + queue->ack(3, false); // Acknowledgement the 3rd message. + + queue->reopen(); + + // m_client.disconnectFromHost(); } void messageReceived() { @@ -43,7 +57,11 @@ private Q_SLOTS: return; QAmqpMessage message = queue->dequeue(); - qDebug() << " [x] Received " << message.payload(); + qDebug() << " [x] Received in" << message.payload(); + + int input=0; + // std::scanf("%d", &input); + qDebug() << " [x] Received out, " << message.deliveryTag() << " | " << message.payload() << " , input = " << input; } private: @@ -53,6 +71,7 @@ private: int main(int argc, char **argv) { + qDebug() << " Recieve starts ... "; QCoreApplication app(argc, argv); Receiver receiver; receiver.start(); diff --git a/tutorials/helloworld/send/main.cpp b/tutorials/helloworld/send/main.cpp index bf75c10..c499594 100644 --- a/tutorials/helloworld/send/main.cpp +++ b/tutorials/helloworld/send/main.cpp @@ -31,8 +31,16 @@ private Q_SLOTS: if (!queue) return; QAmqpExchange *defaultExchange = m_client.createExchange(); - defaultExchange->publish("Hello World!", "hello"); - qDebug() << " [x] Sent 'Hello World!'"; + defaultExchange->publish("Hello World! A", "hello"); + qDebug() << " [x] Sent 'Hello World! A'"; + defaultExchange->publish("Hello World! B", "hello"); + qDebug() << " [x] Sent 'Hello World! B'"; + defaultExchange->publish("Hello World! C", "hello"); + qDebug() << " [x] Sent 'Hello World! C'"; + defaultExchange->publish("Hello World! D", "hello"); + qDebug() << " [x] Sent 'Hello World! D'"; + defaultExchange->publish("Hello World! E", "hello"); + qDebug() << " [x] Sent 'Hello World! E'"; m_client.disconnectFromHost(); }