Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci-downstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI Downstream - MQTT Streaming

on:
workflow_dispatch:
inputs:
opendaq-ref:
description: "openDAQ SDK commit, branch or tag"
required: false
default: ""
pull_request:
Comment thread
alexadereyko marked this conversation as resolved.

jobs:
call-opendaq-reusable:
name: MQTT Streaming
uses: openDAQ/openDAQ-CI/.github/workflows/reusable.yml@v1
with:
opendaq-ref: ${{ github.event.inputs.opendaq-ref || '' }}
packages: >
[
{
"match-jobs": ["ubuntu-*"],
"apt-install": ["mosquitto"],
"run": "mosquitto -d"
},
{
"match-jobs": ["windows-*"],
"winget-install": ["EclipseFoundation.Mosquitto"]
},
{
"match-jobs": ["macos-*"],
"brew-install": ["mosquitto"],
"run": "$(brew --prefix mosquitto)/sbin/mosquitto -d"
}
]
cmake-presets: >
[
{
"configure-preset": "module",
"test-preset": "module-test"
}
]
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ option(${REPO_OPTION_PREFIX}_ENABLE_SSL "Enable building with openSSL" OFF)
opendaq_common_compile_targets_settings()
opendaq_setup_compiler_flags(${REPO_OPTION_PREFIX})

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
add_compile_options(-Wno-unknown-warning-option)
endif()

if (${REPO_OPTION_PREFIX}_ENABLE_TESTS)
message(STATUS "Unit tests in ${REPO_NAME} are ENABLED")
enable_testing()
Expand Down
14 changes: 14 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,20 @@
"clang",
"ninja"
]
},
{
"name": "module",
"hidden": true,
"cacheVariables": {
"DAQMODULES_MQTT_ENABLE_TESTS": "ON"
}
}
],
"testPresets": [
{
"name": "module-test",
"hidden": true,
"configurePreset": "module"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class MqttSubscriberFbImpl final : public FunctionBlock
std::mutex queueMutex;
std::condition_variable queueCv;
mutable std::recursive_mutex processingMutex;
std::mutex componentStatusMutex;

DAQ_MQTT_STREAM_MODULE_API void onSignalsMessage(const mqtt::MqttAsyncClient& subscriber, const mqtt::MqttMessage& msg);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ void MqttSubscriberFbImpl::updateStatuses()
if (!statuses->isUpdated())
return;

std::scoped_lock lock(componentStatusMutex);

if (!jsonConfigErr.ok())
{
setComponentStatusWithMessage(ComponentStatus::Error, jsonConfigErr.buildStatusMessage());
Expand Down Expand Up @@ -508,7 +510,6 @@ void MqttSubscriberFbImpl::processMessageImpl(const mqtt::MqttMessage& msg, cons
decoderFb->processMessage(jsonObjStr, epochTime);
}
}
updateStatuses();
}

void MqttSubscriberFbImpl::processingLoop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class MqttPublisherFbHelper : public DaqTestHelper
}

template <typename vT>
static std::string valueToString(const vT& value, bool quoteString = true)
static std::string valueToString(const vT& value, [[maybe_unused]] bool quoteString = true)
{
std::string result;
if constexpr (std::is_same_v<vT, std::string>)
Expand Down Expand Up @@ -1709,7 +1709,7 @@ TEST_F(MqttPublisherFbTest, DISABLED_MultiReaderTest)
auto send = [&]()
{
std::cout << "---------------sending-data---------------" << std::endl;
for (size_t i = 0; i < samples * divider; i++)
for (size_t i = 0; i < static_cast<size_t>(samples * divider); i++)
{
uint64_t ts0, ts1;
if (i % divider == 0)
Expand Down
Loading
Loading