use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class LineNumberWriter method testSystemInvoker.
private void testSystemInvoker() {
Thread thd = new Thread(new Runnable() {
@Override
public void run() {
ThreadHelper.suspend(5000);
// AgentFeatureComponent afc = (AgentFeatureComponent) getConfigManager().getComponent("hbclientagent",
// "HeartBeatClientAgent");
//
// if (afc == null) {
// return;
// }
//
// String[] urls = (String[]) afc.exchange("hbclientagent.service.discovery",
// "healthmanager-HealthMangerServerWorker-/hm/cache/q");
//
// log.info(this, ">>" + urls);
AbstractSystemInvoker invoker = getSystemInvokerMgr().getSystemInvoker(InvokerType.HTTP);
for (int i = 0; i < 5; i++) {
UAVHttpMessage msg = new UAVHttpMessage();
msg.setIntent("services");
msg.putRequest("service", "hbserveragent-HeartBeatQueryListenWorker-/hb/query");
String res = (String) invoker.invoke("hbserveragent-HeartBeatQueryListenWorker-/hb/query", msg, String.class);
log.info(this, ">>" + res);
// invoker.invoke("hbserveragent-HeartBeatQueryListenWorker-/hb/query", msg, new
// HttpClientCallback() {
//
// @Override
// public void completed(HttpClientCallbackResult result) {
//
// log.info(this, ">>" + result.getReplyDataAsString());
// }
//
// @Override
// public void failed(HttpClientCallbackResult result) {
//
// }
//
// });
}
log.info(this, ">>>>");
}
});
thd.start();
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class HeartBeatQueryListenWorker method adaptRequest.
@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
String messageBody = message.getRequestBodyAsString("UTF-8");
if (log.isDebugEnable()) {
log.debug(this, "HeartBeatQueryListenWorker Request: " + messageBody);
}
UAVHttpMessage msg = new UAVHttpMessage(messageBody);
return msg;
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class NodeOperHttpServer method adaptRequest.
@Override
protected UAVHttpMessage adaptRequest(HttpMessage message) {
String messageBody = message.getRequestBodyAsString("UTF-8");
if (log.isTraceEnable()) {
log.info(this, "NodeOperHttpServer Request: " + messageBody);
}
UAVHttpMessage msg = new UAVHttpMessage(messageBody);
return msg;
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class CollectNodeOperAction method doAction.
@Override
public void doAction(ActionContext context) throws Exception {
AgentFeatureComponent afc = (AgentFeatureComponent) getConfigManager().getComponent("collectclient", "CollectDataAgent");
if (afc == null) {
return;
}
UAVHttpMessage data = (UAVHttpMessage) context.getParam("msg");
String cmd = data.getRequest().get("cmd");
if ("add".equals(cmd)) {
afc.exchange("collectdata.add", data.getRequest().get("task"));
} else if ("del".equals(cmd)) {
afc.exchange("collectdata.del", data.getRequest().get("task"));
} else if ("status".equals(cmd)) {
String status = (String) afc.exchange("collectdata.status", cmd);
data.putResponse(UAVHttpMessage.RESULT, status);
}
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GUIService method createGroupInfoCache.
private void createGroupInfoCache() {
Map<String, Object> where = new HashMap<String, Object>();
where.put("state", 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("where", where);
String dataStr = JSONHelper.toString(data);
Map<String, Object> jsonRequest = new HashMap<String, Object>();
jsonRequest.put("type", "query");
jsonRequest.put("data", dataStr);
HashMap<String, String> dbInfo = new HashMap<String, String>();
dbInfo.put("dataStoreName", "AppHub.group");
dbInfo.put("conllectionName", "uav_groupinfo");
UAVHttpMessage request = new UAVHttpMessage();
request.putRequest("mrd.data", JSONHelper.toString(jsonRequest));
request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
String jsonStr = JSONHelper.toString(request);
byte[] datab = null;
try {
datab = jsonStr.getBytes("utf-8");
} catch (Exception e) {
logger.err(this, "GUIService createGroupInfoCache \n" + e.getMessage());
throw new ApphubException(e);
}
logger.info(this, "GUIService createGroupInfoCache");
GroupCacheCallBack groupCacheCb = new GroupCacheCallBack();
doHttpPost("uav.app.manage.apphubmanager.http.addr", "/ah/group", datab, "application/json", "utf-8", groupCacheCb);
}
Aggregations