Skip to content

Commit

Permalink
Merge pull request #1645 from GRIDAPPSD/releases/2022.04.0
Browse files Browse the repository at this point in the history
Releases/2022.04.0
  • Loading branch information
tonya1 authored Apr 21, 2022
2 parents 646f563 + a243c0e commit 98c4587
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import org.apache.http.auth.UsernamePasswordCredentials;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import gov.pnnl.goss.gridappsd.api.AppManager;
import gov.pnnl.goss.gridappsd.api.ConfigurationManager;
Expand Down Expand Up @@ -206,9 +209,22 @@ public void onMessage(Serializable message) {
for(String str : event.getDestination().split(".")){
System.out.println(str);
}
String appOrServiceid = event.getDestination().split("[.]")[2];
//String appOrServiceid = event.getDestination().split("[.]")[2];
try{
provenWriteProducer.sendBulkMessage(event.getData().toString(), appOrServiceid, instanceId, simulationId, new Date().getTime());
//TODO: Remove if block once changes made in proven cluster to get measurement name from datatype
if(appOrServiceid==null){
JsonParser parser = new JsonParser();
JsonElement data = parser.parse(event.getData().toString());
if (data.isJsonObject()) {
JsonObject dataObj = data.getAsJsonObject();
String datatype = dataObj.get("datatype").getAsString();
if(datatype!=null)
provenWriteProducer.sendBulkMessage(event.getData().toString(), datatype, instanceId, simulationId, new Date().getTime());
}
}
else{
provenWriteProducer.sendBulkMessage(event.getData().toString(), appOrServiceid, instanceId, simulationId, new Date().getTime());
}
}catch(Exception e){

StringWriter sw = new StringWriter();
Expand Down

0 comments on commit 98c4587

Please sign in to comment.