2016-06-14 9 views
1

私は、Mongoシンク、メタデータデータ構造を持つエンティティからのデータを使用して、cygnusを使いこなそうとしています。これまでのところ、私はそれを達成することができませんでした。Fiware - Cygnus mongoSinkメタデータ永続性

私はcygnusバージョン0.13.0を使用しています。 MySQLとCKAN永続性シンクを使用してメタデータ情報を保存することができるようです。

¿Mongoも使用できますか? ¿構成上の問題ですか?

ご協力いただきありがとうございます。

答えて

1

Cygnusは属性メタデータをMongoDBに保存しません。これは、MongoDBで持続するときにCygnusを内部的に使用するためで、この問題に関して強い制約を課しているからです。

とにかく、これを修正するために自分のフォーク内のコードを変更するのは比較的簡単です。

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 
:トリックを行う必要があります

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

doc変数にこの値を追加パラメータString attrMdを渡すと追加:単純にこの方法で顔をしています