Nifi-将 XML 数据加载到 Cassandra 中 [英] Nifi-Loading XML data into Cassandra

查看:40
本文介绍了Nifi-将 XML 数据加载到 Cassandra 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 XML 数据插入 Cassandra DB.请有人建议nifi中的流程.我有 JMS,我需要在上面发布消息数据,然后使用 &将数据插入 Cassandra.

I am trying to insert XML data into Cassandra DB. Please can somebody suggest the flow in nifi. I have JMS on which I need to post messagedata and then consume & insert the data into Cassandra.

推荐答案

我不确定您是否可以将 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.

这篇关于Nifi-将 XML 数据加载到 Cassandra 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆