Skip to content

Commit

Permalink
Merge mwc into bmq
Browse files Browse the repository at this point in the history
MWC or "MiddleWare Core" was a package group developed to support
a myriad of applications at Bloomberg. It's been useful to share
common middleware components between similar technologies, but doesn't
make much sense to support as its own open source library. Moving
forward we are merging it into the BMQ package group to better maintain
it for the BlazingMQ project.

Signed-off-by: Taylor Foxhall <tfoxhall@bloomberg.net>
  • Loading branch information
hallfox committed Oct 18, 2024
1 parent a79dc46 commit d250020
Show file tree
Hide file tree
Showing 783 changed files with 13,200 additions and 14,248 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
- name: Run C++ Unit Tests
run: |
cd ${{ github.workspace }}/build/blazingmq
ctest -E mwcsys_executil.t --output-on-failure
ctest -E bmqsys_executil.t --output-on-failure
unit_tests_python:
name: UT [python]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sanitizers/build_sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,5 @@ mkscript "${SANITIZER_ENV} \${@}" "${DIR_BUILD_BMQ}/run-env.sh"

# 'run-unittests.sh' runs all instrumented unit-tests.
CMD="cd $(realpath "${DIR_BUILD_BMQ}") && "
CMD+="./run-env.sh ctest -E mwcsys_executil.t --output-on-failure"
CMD+="./run-env.sh ctest -E bmqsys_executil.t --output-on-failure"
mkscript "${CMD}" "${DIR_BUILD_BMQ}/run-unittests.sh"
15 changes: 3 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif()

# This repo contains the canonical source of multiple, independently released,
# UORs (mwc, bmq, bmqbrkr, bmqbrkrcfg, bmqtool). When releasing a UOR, that
# UORs (bmq, bmqbrkr, bmqbrkrcfg, bmqtool). When releasing a UOR, that
# specific target is selected through injection of the 'INSTALL_TARGETS'
# variable. Many static analysis tool leverage the generated
# 'compile_commands.json' in order to know which sources to work with.
Expand All @@ -104,8 +104,8 @@ endif()
# that we will only add targets to the intended ones, based on what is
# currently being built. We will set a "BMQ_TARGET_<xyz>_NEEDED" value to
# YES/NO.
# - if INSTALL_TARGETS is empty, this means we are not doing a DPKG build, but
# just a normal developer build, therefore include all targets
# - if INSTALL_TARGETS is empty, this means we are not doing an integration
# build, but just a normal developer build, therefore include all targets
# - otherwise, selectively enable targets based on what is being built

if (NOT DEFINED INSTALL_TARGETS)
Expand Down Expand Up @@ -137,26 +137,18 @@ else()
set(BMQ_TARGET_BMQBRKRCFG_NEEDED NO)
set(BMQ_TARGET_BMQTOOL_NEEDED NO)
set(BMQ_TARGET_BMQSTORAGETOOL_NEEDED NO)
set(BMQ_TARGET_MWC_NEEDED NO)
set(BMQ_TARGET_BMQ_NEEDED NO)
set(BMQ_TARGET_MQB_NEEDED NO)
set(BMQ_TARGET_TUTORIAL_NEEDED NO)
set(BMQ_TARGET_PROMETHEUS_NEEDED NO)

bbproject_check_install_target("mwc" installMWC)
bbproject_check_install_target("bmq" installBMQ)
bbproject_check_install_target("mqb" installMQB)
bbproject_check_install_target("bmqbrkrcfg" installBMQBRKRCFG)
bbproject_check_install_target("bmqtool" installBMQTOOL)
bbproject_check_install_target("bmqstoragetool" installBMQSTORAGETOOL)
bbproject_check_install_target("prometheus" installPROMETHEUS)

# NOTE: All targets should get 'mwc' from DPKG, except for the 'mwc' release
# itself (and the development work).
if (installMWC)
set(BMQ_TARGET_MWC_NEEDED YES)
endif()

if (installBMQ)
set(BMQ_TARGET_BMQ_NEEDED YES)
endif()
Expand Down Expand Up @@ -190,7 +182,6 @@ else()
endif()

if (installPROMETHEUS)
set(BMQ_TARGET_MWC_NEEDED YES)
set(BMQ_TARGET_BMQ_NEEDED YES)
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_PROMETHEUS_NEEDED YES)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/architecture/network_transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ single socket to many thousands of simultaneous sockets."*
### Transport Abstraction

In its implementation, BlazingMQ abstracts the transport by using
[`mwcio`](https://github.com/bloomberg/blazingmq/blob/main/src/groups/mwc/mwcio/mwcio_channel.h)
[`bmqio`](https://github.com/bloomberg/blazingmq/blob/main/src/groups/bmq/bmqio/bmqio_channel.h)
interface, which enables BlazingMQ to plug in any implementation which conforms
to it. In fact, BlazingMQ was using a legacy network transport library instead
of NTF some time back. We have also experimented with plugging in
Expand Down
2 changes: 1 addition & 1 deletion etc/cmake/BMQPlugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function(bmq_add_plugin name)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Configure link-time options.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
_bmq_add_include_paths(${name} DEPS mqb bmq mwc)
_bmq_add_include_paths(${name} DEPS mqb bmq)
target_link_libraries(${name} PRIVATE ${${name}_DEPENDS})

# include( BMQTest )
Expand Down
40 changes: 20 additions & 20 deletions src/applications/bmqbrkr/bmqbrkr.m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#include <mqbu_exit.h>
#include <mqbu_messageguidutil.h>

// MWC
#include <mwcsys_time.h>
#include <mwctsk_alarmlog.h>
#include <mwcu_memoutstream.h>
#include <mwcu_printutil.h>
// BMQ
#include <bmqsys_time.h>
#include <bmqtsk_alarmlog.h>
#include <bmqu_memoutstream.h>
#include <bmqu_printutil.h>

// BDE
#include <balcl_commandline.h>
Expand Down Expand Up @@ -165,7 +165,7 @@ static void bmqAssertHandler(const char* comment, const char* file, int line)
file = "(* Empty File Name *)";
}

mwcu::MemOutStream stackTrace;
bmqu::MemOutStream stackTrace;
balst::StackTracePrintUtil::printStackTrace(stackTrace);
stackTrace << bsl::ends;

Expand Down Expand Up @@ -265,7 +265,7 @@ static int getConfig(bsl::ostream& errorDescription,
bsl::cout << "Reading broker configuration from " << configFilename
<< "\n";
bsl::ifstream configStream(configFilename.c_str());
mwcu::MemOutStream configParameters;
bmqu::MemOutStream configParameters;
configParameters << configStream.rdbuf();
taskEnv->d_configJson = configParameters.str();

Expand Down Expand Up @@ -318,7 +318,7 @@ static void onProcessedAdminCommand(const bsl::string& prefix,
int rc,
const bsl::string& results)
{
const bsls::Types::Int64 end = mwcsys::Time::highResolutionTimer();
const bsls::Types::Int64 end = bmqsys::Time::highResolutionTimer();

if (rc != 0) {
BALL_LOG_ERROR << "Error processing command [rc: " << rc << "] "
Expand All @@ -329,7 +329,7 @@ static void onProcessedAdminCommand(const bsl::string& prefix,
else {
BALL_LOG_INFO << "Command '" << prefix << " " << command
<< "' processed successfully in "
<< mwcu::PrintUtil::prettyTimeInterval(end - start)
<< bmqu::PrintUtil::prettyTimeInterval(end - start)
<< ":\n"
<< results;
}
Expand All @@ -356,7 +356,7 @@ static void onMTrap(TaskEnvironment* taskEnv,
return; // RETURN
}
else if (bdlb::String::areEqualCaseless(prefix, "CMD")) {
const bsls::Types::Int64 start = mwcsys::Time::highResolutionTimer();
const bsls::Types::Int64 start = bmqsys::Time::highResolutionTimer();
taskEnv->d_app.object().enqueueCommand(
"MTRAP",
cmd,
Expand Down Expand Up @@ -391,7 +391,7 @@ static int initializeTask(bsl::ostream& errorDescription,
new (taskEnv->d_task.buffer())
m_bmqbrkr::Task(taskEnv->d_bmqPrefix, taskEnv->d_config.taskConfig());

mwcu::MemOutStream localError;
bmqu::MemOutStream localError;
const int rc = taskEnv->d_task.object().initialize(localError);
if (rc != 0) {
errorDescription << "Failed to initialize task "
Expand All @@ -417,9 +417,9 @@ static int initializeTask(bsl::ostream& errorDescription,
const bsl::string pidFile = taskEnv->d_bmqPrefix + "/bmqbrkr.pid";
bsl::ofstream pidFd(pidFile.c_str());
if (!pidFd) {
MWCTSK_ALARMLOG_ALARM("STARTUP")
BMQTSK_ALARMLOG_ALARM("STARTUP")
<< "Failed to create pid file [" << pidFile << "]."
<< " This is not fatal." << MWCTSK_ALARMLOG_END;
<< " This is not fatal." << BMQTSK_ALARMLOG_END;
}
else {
pidFd << bdls::ProcessUtil::getProcessId() << "\n";
Expand Down Expand Up @@ -537,7 +537,7 @@ static void updateHistFile(const TaskEnvironment* taskEnv)
}

// Generate the new entry
mwcu::MemOutStream os;
bmqu::MemOutStream os;
os << bdlt::CurrentTime::utc() << "|"
<< taskEnv->d_config.appConfig().brokerVersion() << "|"
<< taskEnv->d_config.appConfig().configVersion() << "|"
Expand All @@ -548,9 +548,9 @@ static void updateHistFile(const TaskEnvironment* taskEnv)
// Write back all entries to file
bsl::ofstream output(histFile.c_str());
if (!output) {
MWCTSK_ALARMLOG_ALARM("STARTUP")
BMQTSK_ALARMLOG_ALARM("STARTUP")
<< "Failed to create vers file [" << histFile << "]. "
<< "This is not fatal." << MWCTSK_ALARMLOG_END;
<< "This is not fatal." << BMQTSK_ALARMLOG_END;
}
else {
for (bsl::list<bsl::string>::const_iterator it = entries.begin();
Expand All @@ -570,7 +570,7 @@ static int
run(bsl::ostream& errorDescription, TaskEnvironment* taskEnv, bool wait = true)
{
// Start the application
mwcu::MemOutStream localError;
bmqu::MemOutStream localError;

int rc = taskEnv->d_app.object().start(localError);
if (rc != 0) {
Expand Down Expand Up @@ -697,7 +697,7 @@ int main(int argc, const char* argv[])
taskEnv.d_bmqPrefix = (prefixEnvVar != 0 ? prefixEnvVar : "./");
taskEnv.d_instanceId = instanceId;

mwcu::MemOutStream errorDescription;
bmqu::MemOutStream errorDescription;

rc = getConfig(errorDescription, &taskEnv, configDir);
if (rc != 0) {
Expand Down Expand Up @@ -752,9 +752,9 @@ int main(int argc, const char* argv[])
// Run
rc = run(errorDescription, &taskEnv);
if (rc != 0) {
MWCTSK_ALARMLOG_PANIC("STARTUP")
BMQTSK_ALARMLOG_PANIC("STARTUP")
<< "(" << rc << "): " << errorDescription.str()
<< MWCTSK_ALARMLOG_END;
<< BMQTSK_ALARMLOG_END;
shutdownApplication(&taskEnv);
shutdownTask(&taskEnv);
return mqbu::ExitCode::e_RUN; // RETURN
Expand Down
4 changes: 2 additions & 2 deletions src/applications/bmqbrkr/bmqbrkrscm_versiontag.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#define BMQBRKR_VERSION_PATCH 99
// BMQBRKR patch level

#define BMQBRKR_MAKE_VERSION(major, minor) ((major)*10000 + (minor)*100)
#define BMQBRKR_MAKE_VERSION(major, minor) ((major) * 10000 + (minor) * 100)
// Construct a composite version number in the range [ 0 .. 999900 ] from
// the specified 'major' and 'minor' version numbers. The resulting value,
// when expressed as a 6-digit decimal string, has "00" as the two
Expand All @@ -73,7 +73,7 @@
// and 'minor' are integral values in the range '[ 0 .. 99 ]'.

#define BMQBRKR_MAKE_EXT_VERSION(major, minor, patch) \
((major)*10000 + (minor)*100 + (patch))
((major) * 10000 + (minor) * 100 + (patch))
// Similar to BMQBRKR_MAKE_VERSION(), but include the patch number as well.

#define BMQBRKR_VERSION \
Expand Down
Loading

0 comments on commit d250020

Please sign in to comment.