use of com.creditease.uav.messaging.api.Message in project uavstack by uavorg.
the class AbstractPublishHandler method handle.
@Override
public void handle(List<T> mdflist) {
MessageProducer producer = (MessageProducer) this.getComponentResource("messageproducer", "MessageProducerResourceComponent");
Message msg = MessagingFactory.createMessage(getMessageKey());
String stream = toJSONString(mdflist);
msg.setParam(getMessageKey(), stream);
boolean check = producer.submit(msg);
String sendState = getMessageKey() + " Data Sent " + (check ? "SUCCESS" : "FAIL");
if (log.isTraceEnable()) {
log.info(this, sendState + " " + stream);
}
}
use of com.creditease.uav.messaging.api.Message in project uavstack by uavorg.
the class MonitorScheduleWorker method executeTestCase.
@Override
public void executeTestCase() {
MessageProducer producer = (MessageProducer) this.getComponentResource("messageproducer", "MessageProducerResourceComponent");
// submit Monitor data
Message msg = MessagingFactory.createMessage(MonitorDataFrame.MessageType.Monitor.toString());
String stream = prepareTestData(testcase1);
msg.setParam(MonitorDataFrame.MessageType.Monitor.toString(), stream);
boolean check = producer.submit(msg);
String sendState = "Monitor" + (check ? "SUCCESS" : "FAIL");
if (log.isTraceEnable()) {
log.info(this, sendState + " " + stream);
}
}
use of com.creditease.uav.messaging.api.Message in project uavstack by uavorg.
the class MonitorDataMessageHandler method handle.
@Override
public void handle(Message msg) {
super.handle(msg);
// NOW, we send out the MDF for runtime notification
AgentResourceComponent arc = (AgentResourceComponent) ConfigurationManager.getInstance().getComponent("messageproducer", "MessageProducerResourceComponent");
MessageProducer producer = (MessageProducer) arc.getResource();
if (producer != null) {
String runtimeKey = MonitorDataFrame.MessageType.RuntimeNtf.toString();
Message rtntfmsg = MessagingFactory.createMessage(runtimeKey);
String dataStream = msg.getParam(this.getMsgTypeName());
rtntfmsg.setParam(runtimeKey, dataStream);
boolean check = producer.submit(rtntfmsg);
String sendState = runtimeKey + " Data Sent " + (check ? "SUCCESS" : "FAIL");
if (log.isDebugEnable()) {
log.debug(this, sendState + " " + dataStream);
}
}
}
use of com.creditease.uav.messaging.api.Message in project uavstack by uavorg.
the class NodeInfoDataMessageHandler method handle.
@Override
public void handle(Message msg) {
super.handle(msg);
// NOW, we send out the MDF for runtime notification
AgentResourceComponent arc = (AgentResourceComponent) ConfigurationManager.getInstance().getComponent("messageproducer", "MessageProducerResourceComponent");
MessageProducer producer = (MessageProducer) arc.getResource();
if (producer != null) {
String runtimeKey = MonitorDataFrame.MessageType.RuntimeNtf.toString();
Message rtntfmsg = MessagingFactory.createMessage(runtimeKey);
String dataStream = msg.getParam(this.getMsgTypeName());
rtntfmsg.setParam(runtimeKey, dataStream);
boolean check = producer.submit(rtntfmsg);
String sendState = runtimeKey + " Data Sent " + (check ? "SUCCESS" : "FAIL");
if (log.isDebugEnable()) {
log.debug(this, sendState + " " + dataStream);
}
}
}
use of com.creditease.uav.messaging.api.Message in project uavstack by uavorg.
the class AppServerLogPublishWorkerByStream method handle.
@Override
protected void handle(List<String> streamList) {
MessageProducer producer = (MessageProducer) this.getComponentResource("messageproducer", "MessageProducerResourceComponent");
// submit profile data
Message msg = MessagingFactory.createMessage(MonitorDataFrame.MessageType.Log.toString());
for (String stream : streamList) {
msg.setParam(MonitorDataFrame.MessageType.Log.toString(), stream);
if (log.isDebugEnable()) {
log.debug(this, "## final stream length ## : " + stream.getBytes().length);
log.debug(this, "## final stream value ## : " + stream);
}
/**
* TestUsage: output the result
*/
// IOHelper.write(stream, "" + this.toString());
producer.setLogger(log);
boolean check = producer.submit(msg);
String sendState = "Log Data Sent " + (check ? "SUCCESS" : "FAIL");
if (log.isDebugEnable()) {
log.debug(this, sendState + " " + stream);
}
}
}
Aggregations