This commit is contained in:
parent
9e6798cc32
commit
82f2d89435
|
|
@ -112,6 +112,7 @@
|
||||||
PreprocessorDefinitions=",UNICODE,WIN32,QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_NETWORK_LIB"
|
PreprocessorDefinitions=",UNICODE,WIN32,QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_NETWORK_LIB"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
TreatWChar_tAsBuiltInType="false"
|
TreatWChar_tAsBuiltInType="false"
|
||||||
|
WarningLevel="3"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
|
|
|
||||||
|
|
@ -329,8 +329,8 @@ void QAMQP::Client::close()
|
||||||
|
|
||||||
void QAMQP::Client::reopen()
|
void QAMQP::Client::reopen()
|
||||||
{
|
{
|
||||||
return d_func()->connect();
|
d_func()->disconnect();
|
||||||
return d_func()->disconnect();
|
d_func()->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAMQP::Client::setAuth( Authenticator * auth )
|
void QAMQP::Client::setAuth( Authenticator * auth )
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,18 @@ QAMQP::Channel::Channel(int channelNumber /*= -1*/, Client * parent /*= 0*/ )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QAMQP::Channel::Channel( ChannelPrivate &dd, Client* parent )
|
QAMQP::Channel::Channel( ChannelPrivate &dd, int channelNumber, Client* parent )
|
||||||
: QObject(dd, 0)
|
: QObject(dd, 0)
|
||||||
{
|
{
|
||||||
|
Q_D(QAMQP::Channel);
|
||||||
|
QT_TRY {
|
||||||
|
d->init(channelNumber, parent);
|
||||||
|
} QT_CATCH(...) {
|
||||||
|
ChannelExceptionCleaner::cleanup(this, d_func());
|
||||||
|
QT_RETHROW;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QAMQP::Channel::~Channel()
|
QAMQP::Channel::~Channel()
|
||||||
{
|
{
|
||||||
QObjectPrivate::clearGuards(this);
|
QObjectPrivate::clearGuards(this);
|
||||||
|
|
@ -85,11 +92,6 @@ int QAMQP::Channel::channelNumber()
|
||||||
return d_func()->number;
|
return d_func()->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAMQP::Channel::setParam( int param )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void QAMQP::Channel::setName( const QString &name )
|
void QAMQP::Channel::setName( const QString &name )
|
||||||
{
|
{
|
||||||
d_func()->name = name;
|
d_func()->name = name;
|
||||||
|
|
@ -227,8 +229,9 @@ void ChannelPrivate::flow()
|
||||||
|
|
||||||
void ChannelPrivate::flow( const QAMQP::Frame::Method & frame )
|
void ChannelPrivate::flow( const QAMQP::Frame::Method & frame )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelPrivate::flowOk()
|
void ChannelPrivate::flowOk()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -236,7 +239,7 @@ void ChannelPrivate::flowOk()
|
||||||
|
|
||||||
void ChannelPrivate::flowOk( const QAMQP::Frame::Method & frame )
|
void ChannelPrivate::flowOk( const QAMQP::Frame::Method & frame )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelPrivate::close(int code, const QString & text, int classId, int methodId)
|
void ChannelPrivate::close(int code, const QString & text, int classId, int methodId)
|
||||||
|
|
@ -284,6 +287,7 @@ void ChannelPrivate::closeOk()
|
||||||
|
|
||||||
void ChannelPrivate::closeOk( const QAMQP::Frame::Method & frame )
|
void ChannelPrivate::closeOk( const QAMQP::Frame::Method & frame )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frame);
|
||||||
Q_Q(Channel);
|
Q_Q(Channel);
|
||||||
q->stateChanged(csClosed);
|
q->stateChanged(csClosed);
|
||||||
q->onClose();
|
q->onClose();
|
||||||
|
|
@ -292,6 +296,7 @@ void ChannelPrivate::closeOk( const QAMQP::Frame::Method & frame )
|
||||||
|
|
||||||
void ChannelPrivate::openOk( const QAMQP::Frame::Method & frame )
|
void ChannelPrivate::openOk( const QAMQP::Frame::Method & frame )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frame);
|
||||||
Q_Q(Channel);
|
Q_Q(Channel);
|
||||||
qDebug(">> OpenOK");
|
qDebug(">> OpenOK");
|
||||||
opened = true;
|
opened = true;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ namespace QAMQP
|
||||||
QString name();
|
QString name();
|
||||||
int channelNumber();
|
int channelNumber();
|
||||||
|
|
||||||
void setParam(int param);
|
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
void setQOS(qint32 prefetchSize, quint16 prefetchCount);
|
void setQOS(qint32 prefetchSize, quint16 prefetchCount);
|
||||||
bool isOpened() const;
|
bool isOpened() const;
|
||||||
|
|
@ -39,7 +38,7 @@ namespace QAMQP
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Channel(int channelNumber = -1, Client * parent = 0);
|
Channel(int channelNumber = -1, Client * parent = 0);
|
||||||
Channel(ChannelPrivate &dd, Client* parent);
|
Channel(ChannelPrivate &dd, int channelNumber = -1, Client* parent = 0);
|
||||||
virtual void onOpen();;
|
virtual void onOpen();;
|
||||||
virtual void onClose();;
|
virtual void onClose();;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ void ConnectionPrivate::start( const QAMQP::Frame::Method & frame )
|
||||||
|
|
||||||
void ConnectionPrivate::secure( const QAMQP::Frame::Method & frame )
|
void ConnectionPrivate::secure( const QAMQP::Frame::Method & frame )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionPrivate::tune( const QAMQP::Frame::Method & frame )
|
void ConnectionPrivate::tune( const QAMQP::Frame::Method & frame )
|
||||||
|
|
@ -161,6 +161,7 @@ void ConnectionPrivate::tune( const QAMQP::Frame::Method & frame )
|
||||||
|
|
||||||
void ConnectionPrivate::openOk( const QAMQP::Frame::Method & frame )
|
void ConnectionPrivate::openOk( const QAMQP::Frame::Method & frame )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(frame);
|
||||||
qDebug(">> OpenOK");
|
qDebug(">> OpenOK");
|
||||||
connected = true;
|
connected = true;
|
||||||
q_func()->openOk();
|
q_func()->openOk();
|
||||||
|
|
@ -353,5 +354,5 @@ bool Connection::isConnected() const
|
||||||
|
|
||||||
void Connection::setQOS( qint32 prefetchSize, quint16 prefetchCount )
|
void Connection::setQOS( qint32 prefetchSize, quint16 prefetchCount )
|
||||||
{
|
{
|
||||||
d_func()->setQOS(prefetchSize, prefetchSize, 0, true);
|
d_func()->setQOS(prefetchSize, prefetchCount, 0, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,16 @@ void Exchange::bind( QAMQP::Queue * queue )
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exchange::bind( const QString & queueName )
|
void Exchange::bind( const QString & queueName )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(queueName);
|
||||||
|
qWarning("Not implement");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exchange::bind( const QString & queueName, const QString &key )
|
void Exchange::bind( const QString & queueName, const QString &key )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(queueName);
|
||||||
|
Q_UNUSED(key);
|
||||||
|
qWarning("Not implement");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exchange::publish( const QString & message, const QString & key )
|
void Exchange::publish( const QString & message, const QString & key )
|
||||||
|
|
@ -150,14 +153,14 @@ bool ExchangePrivate::_q_method( const QAMQP::Frame::Method & frame )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExchangePrivate::declareOk( const QAMQP::Frame::Method & frame )
|
void ExchangePrivate::declareOk( const QAMQP::Frame::Method & )
|
||||||
{
|
{
|
||||||
qDebug() << "Declared exchange: " << name;
|
qDebug() << "Declared exchange: " << name;
|
||||||
declared = true;
|
declared = true;
|
||||||
QMetaObject::invokeMethod(q_func(), "declared");
|
QMetaObject::invokeMethod(q_func(), "declared");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExchangePrivate::deleteOk( const QAMQP::Frame::Method & frame )
|
void ExchangePrivate::deleteOk( const QAMQP::Frame::Method & )
|
||||||
{
|
{
|
||||||
qDebug() << "Deleted exchange: " << name;
|
qDebug() << "Deleted exchange: " << name;
|
||||||
declared = false;
|
declared = false;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void QAMQP::Frame::Base::writeEnd( QDataStream & stream ) const
|
||||||
stream << qint8(AMQP_FRAME_END);
|
stream << qint8(AMQP_FRAME_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAMQP::Frame::Base::writePayload( QDataStream & stream ) const{}
|
void QAMQP::Frame::Base::writePayload( QDataStream & ) const{}
|
||||||
|
|
||||||
void QAMQP::Frame::Base::readHeader( QDataStream & stream )
|
void QAMQP::Frame::Base::readHeader( QDataStream & stream )
|
||||||
{
|
{
|
||||||
|
|
@ -330,7 +330,6 @@ void QAMQP::Frame::print( const TableField & f )
|
||||||
void QAMQP::Frame::writeField( qint8 valueType, QDataStream &s, const QVariant & value, bool withType )
|
void QAMQP::Frame::writeField( qint8 valueType, QDataStream &s, const QVariant & value, bool withType )
|
||||||
{
|
{
|
||||||
QByteArray tmp;
|
QByteArray tmp;
|
||||||
qint8 nameSize_;
|
|
||||||
if(withType)
|
if(withType)
|
||||||
s << valueType; // Çàïèøåì òèï ïîëÿ
|
s << valueType; // Çàïèøåì òèï ïîëÿ
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
QAMQP::Network::Network( QObject * parent /*= 0*/ )
|
QAMQP::Network::Network( QObject * parent /*= 0*/ ):QObject(parent)
|
||||||
{
|
{
|
||||||
qRegisterMetaType<QAMQP::Frame::Method>("QAMQP::Frame::Method");
|
qRegisterMetaType<QAMQP::Frame::Method>("QAMQP::Frame::Method");
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ void QAMQP::Network::disconnected()
|
||||||
|
|
||||||
void QAMQP::Network::error( QAbstractSocket::SocketError socketError )
|
void QAMQP::Network::error( QAbstractSocket::SocketError socketError )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(socketError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAMQP::Network::readyRead()
|
void QAMQP::Network::readyRead()
|
||||||
|
|
|
||||||
|
|
@ -280,15 +280,14 @@ void QueuePrivate::deleteOk( const QAMQP::Frame::Method & frame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QueuePrivate::bindOk( const QAMQP::Frame::Method & frame )
|
void QueuePrivate::bindOk( const QAMQP::Frame::Method & )
|
||||||
{
|
{
|
||||||
qDebug() << "Binded to queue: " << name;
|
qDebug() << "Binded to queue: " << name;
|
||||||
QMetaObject::invokeMethod(q_func(), "binded", Q_ARG(bool, true));
|
QMetaObject::invokeMethod(q_func(), "binded", Q_ARG(bool, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueuePrivate::unbindOk( const QAMQP::Frame::Method & frame )
|
void QueuePrivate::unbindOk( const QAMQP::Frame::Method & )
|
||||||
{
|
{
|
||||||
|
|
||||||
qDebug() << "Unbinded queue: " << name;
|
qDebug() << "Unbinded queue: " << name;
|
||||||
QMetaObject::invokeMethod(q_func(), "binded", Q_ARG(bool, false));
|
QMetaObject::invokeMethod(q_func(), "binded", Q_ARG(bool, false));
|
||||||
}
|
}
|
||||||
|
|
@ -439,6 +438,8 @@ void QueuePrivate::getOk( const QAMQP::Frame::Method & frame )
|
||||||
QString exchangeName = readField('s',in).toString();
|
QString exchangeName = readField('s',in).toString();
|
||||||
QString routingKey = readField('s',in).toString();
|
QString routingKey = readField('s',in).toString();
|
||||||
|
|
||||||
|
Q_UNUSED(redelivered)
|
||||||
|
|
||||||
MessagePtr newMessage = MessagePtr(new Message);
|
MessagePtr newMessage = MessagePtr(new Message);
|
||||||
newMessage->routeKey = routingKey;
|
newMessage->routeKey = routingKey;
|
||||||
newMessage->exchangeName = exchangeName;
|
newMessage->exchangeName = exchangeName;
|
||||||
|
|
@ -517,6 +518,8 @@ void QueuePrivate::deliver( const QAMQP::Frame::Method & frame )
|
||||||
QString exchangeName = readField('s',in).toString();
|
QString exchangeName = readField('s',in).toString();
|
||||||
QString routingKey = readField('s',in).toString();
|
QString routingKey = readField('s',in).toString();
|
||||||
|
|
||||||
|
Q_UNUSED(redelivered)
|
||||||
|
|
||||||
MessagePtr newMessage = MessagePtr(new Message);
|
MessagePtr newMessage = MessagePtr(new Message);
|
||||||
newMessage->routeKey = routingKey;
|
newMessage->routeKey = routingKey;
|
||||||
newMessage->exchangeName = exchangeName;
|
newMessage->exchangeName = exchangeName;
|
||||||
|
|
@ -556,8 +559,7 @@ void QueuePrivate::_q_body( int channeNumber, const QByteArray & body )
|
||||||
MessagePtr &message = messages_.head();
|
MessagePtr &message = messages_.head();
|
||||||
message->payload.append(body);
|
message->payload.append(body);
|
||||||
message->leftSize -= body.size();
|
message->leftSize -= body.size();
|
||||||
int size = message->leftSize;
|
|
||||||
|
|
||||||
if(message->leftSize == 0 && messages_.size() == 1)
|
if(message->leftSize == 0 && messages_.size() == 1)
|
||||||
{
|
{
|
||||||
QMetaObject::invokeMethod(q_func(), "messageRecieved");
|
QMetaObject::invokeMethod(q_func(), "messageRecieved");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue