[+] custom client properties
This commit is contained in:
parent
8fb83ba1a4
commit
1f2aaec772
|
|
@ -169,6 +169,7 @@ void ClientPrivate::disconnect()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -367,4 +368,14 @@ void QAMQP::Client::setAutoReconnect( bool value )
|
|||
bool QAMQP::Client::isConnected() const
|
||||
{
|
||||
return pd_func()->connection_->isConnected();
|
||||
}
|
||||
}
|
||||
|
||||
void QAMQP::Client::addCustomProperty( const QString & name, const QString & value )
|
||||
{
|
||||
return pd_func()->connection_->addCustomProperty(name, value);
|
||||
}
|
||||
|
||||
QString QAMQP::Client::customProperty( const QString & name ) const
|
||||
{
|
||||
return pd_func()->connection_->customProperty(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ namespace QAMQP
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDataStream>
|
||||
#include <QVariant>
|
||||
|
||||
using namespace QAMQP;
|
||||
|
||||
|
|
@ -29,6 +30,8 @@ namespace QAMQP
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -62,6 +65,7 @@ void ConnectionPrivate::startOk()
|
|||
clientProperties["version"] = QString(QAMQP_VERSION);
|
||||
clientProperties["platform"] = QString("Qt %1").arg(qVersion());
|
||||
clientProperties["product"] = QString("QAMQP");
|
||||
clientProperties.unite(customProperty);
|
||||
QAMQP::Frame::serialize(stream, clientProperties);
|
||||
|
||||
client_->pd_func()->auth_->write(stream);
|
||||
|
|
@ -346,3 +350,18 @@ void Connection::setQOS( qint32 prefetchSize, quint16 prefetchCount )
|
|||
{
|
||||
pd_func()->setQOS(prefetchSize, prefetchCount, 0, true);
|
||||
}
|
||||
|
||||
|
||||
void Connection::addCustomProperty( const QString & name, const QString & value )
|
||||
{
|
||||
pd_func()->customProperty[name] = value;
|
||||
}
|
||||
|
||||
QString Connection::customProperty( const QString & name ) const
|
||||
{
|
||||
if(pd_func()->customProperty.contains(name))
|
||||
{
|
||||
return pd_func()->customProperty.value(name).toString();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ namespace QAMQP
|
|||
public:
|
||||
~Connection();
|
||||
|
||||
|
||||
void addCustomProperty(const QString & name, const QString & value);
|
||||
QString customProperty(const QString & name) const;
|
||||
|
||||
void startOk();
|
||||
void secureOk();
|
||||
void tuneOk();
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ namespace QAMQP
|
|||
bool connected;
|
||||
|
||||
Connection * const pq_ptr;
|
||||
|
||||
QAMQP::Frame::TableField customProperty;
|
||||
|
||||
};
|
||||
}
|
||||
#endif // amqp_connection_p_h__
|
||||
#endif // amqp_connection_p_h__
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace QAMQP
|
|||
ClientPrivate(Client * q ) ;
|
||||
~ClientPrivate();
|
||||
|
||||
|
||||
void init(QObject * parent);
|
||||
void init(QObject * parent, const QUrl & connectionString);
|
||||
void printConnect() const;
|
||||
|
|
@ -45,5 +46,6 @@ namespace QAMQP
|
|||
Client * const pq_ptr;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif // amqp_p_h__
|
||||
|
|
|
|||
Loading…
Reference in New Issue