Skip to content
Snippets Groups Projects
Commit 781421a6 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Task #7342: Using derived class from 'Message' in the MACScheduler.

parent a7334494
No related branches found
No related tags found
No related merge requests found
......@@ -2431,6 +2431,7 @@ LCS/MessageBus/data/task_spec_system_78958.txt -text
LCS/MessageBus/data/task_spec_system_empty.txt -text
LCS/MessageBus/data/task_spec_system_no_ids.txt -text
LCS/MessageBus/data/task_spec_system_xml_error.txt -text
LCS/MessageBus/include/MessageBus/Protocols/TaskSpecificationSystem.h -text
LCS/MessageBus/src/LofarMsgTemplate.txt -text
LCS/MessageBus/src/Message.cc -text
LCS/MessageBus/src/Routing.conf -text
......
......@@ -10,4 +10,5 @@ install(FILES
TaskFeedbackDataproducts.h
TaskFeedbackProcessing.h
TaskFeedbackStatus.h
TaskSpecificationSystem.h
DESTINATION include/${PACKAGE_NAME}/Protocols)
//# TaskSpecificationSystem.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: TaskSpecificationSystem.h 30864 2015-02-03 16:07:56Z mol $
#ifndef LOFAR_MESSAGEBUS_TASK_SPECIFICATION_SYSTEM_H
#define LOFAR_MESSAGEBUS_TASK_SPECIFICATION_SYSTEM_H
#ifdef HAVE_QPID
#include <MessageBus/Message.h>
#include <Common/ParameterSet.h>
#include <Common/StringUtil.h>
namespace LOFAR {
namespace Protocols {
class TaskSpecificationSystem: public Message
{
public:
TaskSpecificationSystem(
// 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,
// Identifiers for the context of this message
const std::string &momID,
const std::string &sasID,
// Payload: a parset containing the generated feedback
const ParameterSet &feedback
):
Message( from, forUser, summary, "task.specification.system", "1.0.0", momID, sasID)
{
std::string buffer;
feedback.writeBuffer(buffer);
setTXTPayload(buffer);
}
// Parse a message
TaskSpecificationSystem(const qpid::messaging::Message qpidMsg) :
Message(qpidMsg)
{ }
// Read a message from disk (header + payload)
TaskSpecificationSystem(const std::string &rawContent) :
Message(rawContent)
{ }
ParameterSet specfications() const {
ParameterSet result;
result.adoptBuffer(payload());
return result;
}
};
} // namespace Protocols
} // namespace LOFAR
#endif
#endif
......@@ -28,6 +28,7 @@
#include <Common/ParameterSet.h>
#include <GCF/TM/GCF_Protocols.h>
#include <MACIO/MACServiceInfo.h>
#include <MessageBus/Protocols/TaskSpecificationSystem.h>
#include <GCF/PVSS/GCF_PVTypes.h>
#include <APL/APLCommon/APL_Defines.h>
#include <APL/APLCommon/ControllerDefines.h>
......@@ -47,6 +48,7 @@ using namespace LOFAR::GCF::PVSS;
using namespace LOFAR::GCF::TM;
using namespace LOFAR::GCF::RTDB;
using namespace LOFAR::OTDB;
using namespace LOFAR::Protocols;
using namespace boost::posix_time;
using namespace std;
......@@ -834,10 +836,14 @@ void MACScheduler::_setParsetOnMsgBus(const string& filename) const
string sasID = obsSpecs.getString(obsPrefix + ".otdbID");
// from, forUser, summary, protocol, protocolVersion, momID, sasID
#if 1
TaskSpecificationSystem outMsg("LOFAR.MACScheduler", "", "", momID, sasID, obsSpecs);
#else
Message outMsg("LOFAR.MACScheduler", "", "", "task.specification.system", "1.0", momID, sasID);
stringstream ss;
obsSpecs.writeStream(ss);
outMsg.setTXTPayload(ss.str());
#endif
cout << outMsg << endl;
itsMsgQueue->send(outMsg);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment