2014-05-29 01:05:51 +08:00
|
|
|
#ifndef amqp_client_h__
|
|
|
|
|
#define amqp_client_h__
|
2014-05-29 00:25:28 +08:00
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QUrl>
|
2014-05-29 04:28:45 +08:00
|
|
|
#include <QHostAddress>
|
2014-05-29 00:25:28 +08:00
|
|
|
|
2014-05-29 03:33:15 +08:00
|
|
|
#include "amqp_global.h"
|
|
|
|
|
|
2014-05-29 00:25:28 +08:00
|
|
|
namespace QAMQP
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class Exchange;
|
|
|
|
|
class Queue;
|
|
|
|
|
class ClientPrivate;
|
|
|
|
|
class Authenticator;
|
|
|
|
|
class ConnectionPrivate;
|
2014-05-29 03:33:15 +08:00
|
|
|
class QAMQP_EXPORT Client : public QObject
|
2014-05-29 00:25:28 +08:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PROPERTY(quint32 port READ port WRITE setPort)
|
|
|
|
|
Q_PROPERTY(QString host READ host WRITE setHost)
|
|
|
|
|
Q_PROPERTY(QString virtualHost READ virtualHost WRITE setVirtualHost)
|
|
|
|
|
Q_PROPERTY(QString user READ user WRITE setUser)
|
|
|
|
|
Q_PROPERTY(QString password READ password WRITE setPassword)
|
|
|
|
|
Q_PROPERTY(bool ssl READ isSsl WRITE setSsl)
|
|
|
|
|
Q_PROPERTY(bool autoReconnect READ autoReconnect WRITE setAutoReconnect)
|
2014-05-29 01:05:51 +08:00
|
|
|
Q_PROPERTY(bool connected READ isConnected)
|
2014-05-29 00:25:28 +08:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Client(QObject *parent = 0);
|
|
|
|
|
Client(const QUrl &connectionString, QObject *parent = 0);
|
|
|
|
|
~Client();
|
|
|
|
|
|
|
|
|
|
void printConnect() const;
|
|
|
|
|
void closeChannel();
|
|
|
|
|
|
|
|
|
|
void addCustomProperty(const QString &name, const QString &value);
|
|
|
|
|
QString customProperty(const QString &name) const;
|
|
|
|
|
|
|
|
|
|
Exchange *createExchange(int channelNumber = -1);
|
|
|
|
|
Exchange *createExchange(const QString &name, int channelNumber = -1);
|
|
|
|
|
|
|
|
|
|
Queue *createQueue(int channelNumber = -1);
|
|
|
|
|
Queue *createQueue(const QString &name, int channelNumber = -1);
|
|
|
|
|
|
|
|
|
|
quint16 port() const;
|
|
|
|
|
void setPort(quint16 port);
|
|
|
|
|
|
|
|
|
|
QString host() const;
|
|
|
|
|
void setHost(const QString &host);
|
|
|
|
|
|
|
|
|
|
QString virtualHost() const;
|
|
|
|
|
void setVirtualHost(const QString &virtualHost);
|
|
|
|
|
|
|
|
|
|
QString user() const;
|
|
|
|
|
void setUser(const QString &user);
|
|
|
|
|
|
|
|
|
|
QString password() const;
|
|
|
|
|
void setPassword(const QString &password);
|
|
|
|
|
|
|
|
|
|
void setAuth(Authenticator *auth);
|
|
|
|
|
Authenticator *auth() const;
|
|
|
|
|
|
|
|
|
|
void open();
|
|
|
|
|
void open(const QUrl &connectionString);
|
|
|
|
|
void close();
|
|
|
|
|
void reopen();
|
|
|
|
|
|
|
|
|
|
bool isSsl() const;
|
|
|
|
|
void setSsl(bool value);
|
|
|
|
|
|
|
|
|
|
bool autoReconnect() const;
|
|
|
|
|
void setAutoReconnect(bool value);
|
|
|
|
|
|
|
|
|
|
bool isConnected() const;
|
|
|
|
|
|
2014-05-29 04:28:45 +08:00
|
|
|
Q_SIGNALS:
|
2014-05-29 00:25:28 +08:00
|
|
|
void connected();
|
|
|
|
|
void disconnected();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Q_DISABLE_COPY(Client)
|
2014-05-29 04:28:45 +08:00
|
|
|
Q_DECLARE_PRIVATE(Client)
|
2014-05-29 00:25:28 +08:00
|
|
|
QScopedPointer<ClientPrivate> d_ptr;
|
|
|
|
|
|
|
|
|
|
friend class ConnectionPrivate;
|
|
|
|
|
friend class ChannelPrivate;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QAMQP
|
|
|
|
|
|
2014-05-29 01:05:51 +08:00
|
|
|
#endif // amqp_client_h__
|