Fiware - Cygnus mongoSink 元数据持久化
Fiware - Cygnus mongoSink metadata persistence
我正在尝试使用 Mongo 接收器坚持使用 cygnus,数据来自具有元数据数据结构的实体。到目前为止,我还没能做到这一点。
我使用的是 cygnus 版本 0.13.0。似乎可以使用 MySQL 和 CKAN 持久性接收器来保存元数据信息。
¿是否也可以使用 Mongo?
¿这是配置问题吗?
在此先感谢您的帮助。
Cygnus 不在 MongoDB 中存储属性元数据。这是因为我们在坚持 MongoDB 时对 Cygnus 的内部使用对这个问题施加了很强的约束。
无论如何,修改自己的fork中的代码来解决这个问题应该是相对容易的。简单看看这个方法:
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
从配置文件的版本 1.8.0, FIWARE CYGNUS adds metadata support. As you can see in the template 开始,您唯一需要做的就是将 属性 cygnus-ngsi.sinks.mongo-sink.attr_metadata_store
设置为 True,顺便说一句,它被设置为 False默认。
此致!
我正在尝试使用 Mongo 接收器坚持使用 cygnus,数据来自具有元数据数据结构的实体。到目前为止,我还没能做到这一点。
我使用的是 cygnus 版本 0.13.0。似乎可以使用 MySQL 和 CKAN 持久性接收器来保存元数据信息。
¿是否也可以使用 Mongo? ¿这是配置问题吗?
在此先感谢您的帮助。
Cygnus 不在 MongoDB 中存储属性元数据。这是因为我们在坚持 MongoDB 时对 Cygnus 的内部使用对这个问题施加了很强的约束。
无论如何,修改自己的fork中的代码来解决这个问题应该是相对容易的。简单看看这个方法:
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
从配置文件的版本 1.8.0, FIWARE CYGNUS adds metadata support. As you can see in the template 开始,您唯一需要做的就是将 属性 cygnus-ngsi.sinks.mongo-sink.attr_metadata_store
设置为 True,顺便说一句,它被设置为 False默认。
此致!