Auto merge of #2189 - bitcartel:1.0.7_with_apache_qpid, r=bitcartel

Add AMQP 1.0 support via Apache Qpid Proton C++ API 0.17.0

Closes #2188
This commit is contained in:
zkbot
2017-04-16 15:09:19 +00:00
23 changed files with 1284 additions and 4 deletions

View File

@@ -59,6 +59,10 @@
#include "zmq/zmqnotificationinterface.h"
#endif
#if ENABLE_PROTON
#include "amqp/amqpnotificationinterface.h"
#endif
using namespace std;
extern void ThreadSendAlert();
@@ -74,6 +78,10 @@ bool fFeeEstimatesInitialized = false;
static CZMQNotificationInterface* pzmqNotificationInterface = NULL;
#endif
#if ENABLE_PROTON
static AMQPNotificationInterface* pAMQPNotificationInterface = NULL;
#endif
#ifdef WIN32
// Win32 LevelDB doesn't use file descriptors, and the ones used for
// accessing block files don't count towards the fd_set size limit
@@ -236,6 +244,14 @@ void Shutdown()
}
#endif
#if ENABLE_PROTON
if (pAMQPNotificationInterface) {
UnregisterValidationInterface(pAMQPNotificationInterface);
delete pAMQPNotificationInterface;
pAMQPNotificationInterface = NULL;
}
#endif
#ifndef WIN32
try {
boost::filesystem::remove(GetPidFile());
@@ -414,6 +430,14 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-zmqpubrawtx=<address>", _("Enable publish raw transaction in <address>"));
#endif
#if ENABLE_PROTON
strUsage += HelpMessageGroup(_("AMQP 1.0 notification options:"));
strUsage += HelpMessageOpt("-amqppubhashblock=<address>", _("Enable publish hash block in <address>"));
strUsage += HelpMessageOpt("-amqppubhashtx=<address>", _("Enable publish hash transaction in <address>"));
strUsage += HelpMessageOpt("-amqppubrawblock=<address>", _("Enable publish raw block in <address>"));
strUsage += HelpMessageOpt("-amqppubrawtx=<address>", _("Enable publish raw transaction in <address>"));
#endif
strUsage += HelpMessageGroup(_("Debugging/Testing options:"));
if (showDebug)
{
@@ -1239,6 +1263,21 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
#endif
#if ENABLE_PROTON
pAMQPNotificationInterface = AMQPNotificationInterface::CreateWithArguments(mapArgs);
if (pAMQPNotificationInterface) {
// AMQP support is currently an experimental feature, so fail if user configured AMQP notifications
// without enabling experimental features.
if (!fExperimentalMode) {
return InitError(_("AMQP support requires -experimentalfeatures."));
}
RegisterValidationInterface(pAMQPNotificationInterface);
}
#endif
// ********************************************************* Step 7: load block chain
fReindex = GetBoolArg("-reindex", false);