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

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

问题描述

我正在尝试将XML数据插入Cassandra DB.请有人可以建议您使用nifi.我有一个JMS,我需要在该JMS上发布messagedata然后使用&将数据插入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中.但是,您可以使用

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语句,则可能需要

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 ,然后 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天全站免登陆