且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Nifi-将 XML 数据加载到 Cassandra 中

更新时间:2023-10-31 17:17:28

我不确定您是否可以将 XML 直接摄取到 Cassandra 中.但是,您可以使用 TransformXml 处理器(和 this XSLT),或者从 NiFi 1.2.0 开始,您可以使用 ConvertRecord 通过指定输入和输出模式.

I'm not sure if you can directly ingest XML into Cassandra. However you could convert the XML to JSON using the TransformXml processor (and this XSLT), or as of NiFi 1.2.0, you can use ConvertRecord by specifying the input and output schemas.

如果每个流文件有多个 XML 记录,并且每个记录需要一个 CQL 语句,则可能需要 SplitJsonSplitRecord.

If there are multiple XML records per flow file and you need one CQL statement per record, you may need SplitJson or SplitRecord after the XML-to-JSON conversion has taken place.

然后就可以使用ReplaceText形成CQL语句来插入 JSON,然后 PutCassandraQL 推送到 Cassandra.或者,您可以使用 CQL 地图语法插入地图字段等

Then you can use ReplaceText to form a CQL statement to insert the JSON, then PutCassandraQL to push to Cassandra. Alternatively you can use CQL map syntax to insert into a map field, etc.