Add AMQP 1.0 support via Apache Qpid Proton C++ API 0.17.0
This commit is contained in:
39
src/init.cpp
39
src/init.cpp
@@ -58,6 +58,10 @@
|
||||
#include "zmq/zmqnotificationinterface.h"
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
#include "amqp/amqpnotificationinterface.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern void ThreadSendAlert();
|
||||
@@ -73,6 +77,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
|
||||
@@ -233,6 +241,14 @@ void Shutdown()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_PROTON
|
||||
if (pAMQPNotificationInterface) {
|
||||
UnregisterValidationInterface(pAMQPNotificationInterface);
|
||||
delete pAMQPNotificationInterface;
|
||||
pAMQPNotificationInterface = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
try {
|
||||
boost::filesystem::remove(GetPidFile());
|
||||
@@ -408,6 +424,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)
|
||||
{
|
||||
@@ -1230,6 +1254,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);
|
||||
|
||||
Reference in New Issue
Block a user