2016-06-14 100 views
1

我試圖堅持與cygnus使用Mongo接收器,實體數據與元數據數據estructures。到目前爲止,我一直無法做到這一點。Fiware - Cygnus mongoSink元數據持久性

我正在使用cygnus版本0.13.0。似乎可以使用MySQL和CKAN持久性接收器來保存元數據信息。

¿是否有可能使用Mongo? ¿是配置問題嗎?

在此先感謝您的幫助。

回答

1

Cygnus不在MongoDB中存儲屬性元數據。這是因爲我們在堅持使用MongoDB時對天鵝座的內部使用,這對這個問題施加了強大的限制。

無論如何,修改自己的分支中的代碼以修復此問題應該相對容易。只要有這個方法一看:

private Document createDoc(long recvTimeTs, String entityId, String entityType, String attrName, String attrType, String attrValue) { 

傳遞一個額外的參數String attrMd和追加該值的doc變量應該做的伎倆:

private Document createDoc(long recvTimeTs, String entityId, String entityType, String attrName, String attrType, String attrValue, String attrMd) { 
    Document doc = new Document("recvTime", new Date(recvTimeTs)); 

    switch (dataModel) { 
     case DMBYSERVICEPATH: 
      doc.append("entityId", entityId) 
        .append("entityType", entityType) 
        .append("attrName", attrName) 
        .append("attrType", attrType) 
        .append("attrValue", attrValue) 
        .append("attrMd", attrMd); 
      break; 
     case DMBYENTITY: 
      doc.append("attrName", attrName) 
        .append("attrType", attrType) 
        .append("attrValue", attrValue) 
        .append("attrMd", attrMd); 
      break; 
     case DMBYATTRIBUTE: 
      doc.append("attrType", attrType) 
        .append("attrValue", attrValue) 
        .append("attrMd", attrMd); 
      break; 
     default: 
      return null; // this will never be reached 
    } // switch 

    return doc; 
} // createDoc