diff --git a/LCS/MessageBus/include/MessageBus/Protocols/CMakeLists.txt b/LCS/MessageBus/include/MessageBus/Protocols/CMakeLists.txt index 902eaf1f50d37e3a17fdaac33dbc3f39ab099973..0ef4a1864450c71d3e6119a8501ffab16c23f51f 100644 --- a/LCS/MessageBus/include/MessageBus/Protocols/CMakeLists.txt +++ b/LCS/MessageBus/include/MessageBus/Protocols/CMakeLists.txt @@ -8,4 +8,6 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink # Install header files. install(FILES TaskFeedbackDataproducts.h + TaskFeedbackProcessing.h + TaskFeedbackStatus.h DESTINATION include/${PACKAGE_NAME}/Protocols) diff --git a/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackDataproducts.h b/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackDataproducts.h index a6fbd65b1133f13f8f47e661a93d7b297c8290b7..48d65c1a0a73b0977a7d5bf6c1a8bb6a5e397bca 100644 --- a/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackDataproducts.h +++ b/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackDataproducts.h @@ -31,16 +31,13 @@ namespace LOFAR { namespace Protocols { -// Name of the system sending these messages -static const std::string system = "LOFAR"; - -// Version of the header we write -static const std::string headerVersion = "1.0.0"; - class TaskFeedbackDataproducts: public Message { public: TaskFeedbackDataproducts( + // Name of the service or process producing this message + const std::string &from, + // End-user responsible for this request (if applicable) const std::string &forUser, @@ -51,7 +48,7 @@ public: const ParameterSet &feedback ): Message( - "lofar.task.feedback.dataproducts", + from, forUser, summary, "lofar.task.feedback.dataproducts", diff --git a/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackProcessing.h b/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackProcessing.h new file mode 100644 index 0000000000000000000000000000000000000000..c09d630f95aeb704609b383fe61012ca77204efd --- /dev/null +++ b/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackProcessing.h @@ -0,0 +1,92 @@ +//# TaskFeedbackProcessing.h: Protocol for emission of processing feedback information +//# +//# Copyright (C) 2015 +//# ASTRON (Netherlands Institute for Radio Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +//# +//# This file is part of the LOFAR software suite. +//# The LOFAR software suite is free software: you can redistribute it and/or +//# modify it under the terms of the GNU General Public License as published +//# by the Free Software Foundation, either version 3 of the License, or +//# (at your option) any later version. +//# +//# The LOFAR software suite is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License along +//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. +//# +//# $Id$ + +#ifndef LOFAR_MESSAGEBUS_TASK_FEEDBACK_PROCESSING_H +#define LOFAR_MESSAGEBUS_TASK_FEEDBACK_PROCESSING_H + +#ifdef HAVE_QPID +#include <MessageBus/Message.h> +#include <Common/ParameterSet.h> + +namespace LOFAR { + +namespace Protocols { + +class TaskFeedbackProcessing: public Message +{ +public: + TaskFeedbackProcessing( + // Name of the service or process producing this message + const std::string &from, + + // End-user responsible for this request (if applicable) + const std::string &forUser, + + // Human-readable summary describing this request + const std::string &summary, + + // Payload: a parset containing the generated feedback + const ParameterSet &feedback + ): + Message( + from, + forUser, + summary, + "lofar.task.feedback.processing", + "1.0.0") + { + std::string buffer; + + feedback.writeBuffer(buffer); + setTXTPayload(buffer); + } + + // Parse a message + TaskFeedbackProcessing(const qpid::messaging::Message qpidMsg) + : + Message(qpidMsg) + { + } + + // Read a message from disk (header + payload) + TaskFeedbackProcessing(const std::string &rawContent) + : + Message(rawContent) + { + } + + ParameterSet feedback() const { + ParameterSet result; + result.adoptBuffer(payload()); + + return result; + } +}; + +} // namespace Protocols + +} // namespace LOFAR + +#endif + +#endif + diff --git a/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackStatus.h b/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackStatus.h new file mode 100644 index 0000000000000000000000000000000000000000..df2f8cb22a23bf0e92537348b5f373a45e13d771 --- /dev/null +++ b/LCS/MessageBus/include/MessageBus/Protocols/TaskFeedbackStatus.h @@ -0,0 +1,92 @@ +//# TaskFeedbackStatus.h: Protocol for emission of status feedback information +//# +//# Copyright (C) 2015 +//# ASTRON (Netherlands Institute for Radio Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +//# +//# This file is part of the LOFAR software suite. +//# The LOFAR software suite is free software: you can redistribute it and/or +//# modify it under the terms of the GNU General Public License as published +//# by the Free Software Foundation, either version 3 of the License, or +//# (at your option) any later version. +//# +//# The LOFAR software suite is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License along +//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. +//# +//# $Id$ + +#ifndef LOFAR_MESSAGEBUS_TASK_FEEDBACK_STATUS_H +#define LOFAR_MESSAGEBUS_TASK_FEEDBACK_STATUS_H + +#ifdef HAVE_QPID +#include <MessageBus/Message.h> +#include <Common/ParameterSet.h> +#include <Common/StringUtil.h> + +namespace LOFAR { + +namespace Protocols { + +class TaskFeedbackStatus: public Message +{ +public: + TaskFeedbackStatus( + // Name of the service or process producing this message + const std::string &from, + + // End-user responsible for this request (if applicable) + const std::string &forUser, + + // Human-readable summary describing this request + const std::string &summary, + + // Payload: a boolean indicating success + bool success; + ): + Message( + from, + forUser, + summary, + "lofar.task.feedback.status", + "1.0.0") + { + setXMLPayload(formatString( + "<task>%s</task>", + status ? "FINISHED" : "ABORT"); + } + + // Parse a message + TaskFeedbackStatus(const qpid::messaging::Message qpidMsg) + : + Message(qpidMsg) + { + } + + // Read a message from disk (header + payload) + TaskFeedbackStatus(const std::string &rawContent) + : + Message(rawContent) + { + } + + ParameterSet feedback() const { + ParameterSet result; + result.adoptBuffer(payload()); + + return result; + } +}; + +} // namespace Protocols + +} // namespace LOFAR + +#endif + +#endif +