diff --git a/CMakeLists.txt b/CMakeLists.txt index e5d2e4c5..6a52d8ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ set(AGENT_VERSION_MAJOR 2) set(AGENT_VERSION_MINOR 3) set(AGENT_VERSION_PATCH 0) -set(AGENT_VERSION_BUILD 13) +set(AGENT_VERSION_BUILD 14) set(AGENT_VERSION_RC "") # This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index 6aa004cf..6740e358 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -29,7 +29,7 @@ # --------------------------------------------------------------------- # base image - alpine 3.18 -FROM alpine:3.18 AS os +FROM alpine:3.19 AS os # --------------------------------------------------------------------- # build @@ -63,7 +63,9 @@ RUN apk --update add \ python3 \ ruby \ ruby-rake \ - && PIP_ROOT_USER_ACTION='ignore' pip install conan + && python3 -m venv /python/conan \ + && . /python/conan/bin/activate \ + && PIP_ROOT_USER_ACTION='ignore' pip install conan # make an agent directory and cd into it WORKDIR /root/agent @@ -80,6 +82,7 @@ RUN if [ -z "$WITH_TESTS" ] || [ "$WITH_TESTS" = "false" ]; then \ else \ WITH_TESTS_ARG=""; \ fi \ + && . /python/conan/bin/activate \ && conan profile detect \ && conan create cppagent \ --build=missing \ diff --git a/src/mtconnect/pipeline/json_mapper.cpp b/src/mtconnect/pipeline/json_mapper.cpp index b81214d5..a7117bf3 100644 --- a/src/mtconnect/pipeline/json_mapper.cpp +++ b/src/mtconnect/pipeline/json_mapper.cpp @@ -137,6 +137,8 @@ namespace mtconnect::pipeline { } else { + if (m_source) + dataItem->setDataSource(*m_source); m_entities.push_back(obs); m_forward(std::move(obs)); } @@ -169,6 +171,7 @@ namespace mtconnect::pipeline { DevicePtr m_defaultDevice; optional m_timestamp; optional m_duration; + optional m_source; EntityList m_entities; PipelineContextPtr m_pipelineContext; @@ -1014,6 +1017,7 @@ namespace mtconnect::pipeline { { static const auto GetParseError = rj::GetParseError_En; + auto source = entity->maybeGet("source"); auto json = std::dynamic_pointer_cast(entity); DevicePtr device = json->m_device.lock(); auto &body = entity->getValue(); @@ -1023,7 +1027,8 @@ namespace mtconnect::pipeline { reader.IterativeParseInit(); ParserContext context(m_context); context.m_forward = [this](entity::EntityPtr &&entity) { next(std::move(entity)); }; - + context.m_source = source; + TopLevelHandler handler(context); if (device) handler.m_context.m_defaultDevice = device; diff --git a/src/mtconnect/pipeline/message_mapper.hpp b/src/mtconnect/pipeline/message_mapper.hpp index 9588e446..1941fd57 100644 --- a/src/mtconnect/pipeline/message_mapper.hpp +++ b/src/mtconnect/pipeline/message_mapper.hpp @@ -46,6 +46,7 @@ namespace mtconnect::pipeline { EntityPtr operator()(entity::EntityPtr &&entity) override { + auto source = entity->maybeGet("source"); auto data = std::dynamic_pointer_cast(entity); if (data->m_dataItem) { @@ -56,7 +57,11 @@ namespace mtconnect::pipeline { auto obs = observation::Observation::make(data->m_dataItem, props, std::chrono::system_clock::now(), errors); if (errors.empty()) + { + if (source) + data->m_dataItem->setDataSource(*source); return next(std::move(obs)); + } } catch (entity::EntityError &e) { diff --git a/src/mtconnect/pipeline/topic_mapper.hpp b/src/mtconnect/pipeline/topic_mapper.hpp index 3d006771..ab1efc6e 100644 --- a/src/mtconnect/pipeline/topic_mapper.hpp +++ b/src/mtconnect/pipeline/topic_mapper.hpp @@ -173,7 +173,7 @@ namespace mtconnect::pipeline { std::tie(device, dataItem) = resolve(*topic); } } - + result = std::make_shared("DataMessage", props); } result->m_dataItem = dataItem;