Idioma,

There is not yet a JSON-to-JSON translator, although there is a Jira case
to add it (https://issues.apache.org/jira/browse/NIFI-361) However you have
a handful of options here:

1) If you don't have a specific output format in mind, use Simon's approach
to generate a JSON file with the desired attributes.
2) Get the appropriate JSON elements into attributes using
EvaluateJsonPath, then ReplaceText for the new format
3) Use EvaluateJsonPath as above, then use Uwe's template processor (
https://github.com/uwegeercken/nifi_processors)
4) Use ExecuteScript and write a script in Groovy, Javascript, Jython,
JRuby, or Lua to do the custom translation
5) Write your own processor (and please feel welcome to share it with the
community!)

If you go with Option 4, I have some Groovy code that builds a
Tinkerpop3-compliant GraphSON document from NiFi provenance events, the
builder pattern might be useful to you if you need GraphSON for the Titan
backend. The code is available as a Gist (
https://gist.github.com/mattyb149/a43a5c12c39701c4a2feeed71a57c66c), and I
have other examples of JSON-to-JSON conversion on my blog (
funnifi.blogspot.com).

Regards,
Matt

On Thu, Mar 31, 2016 at 7:20 AM, idioma <corda.ila...@gmail.com> wrote:

> Hi,
> I am very new to NiFi and I have the following flow:
>
> Consume Messages from Kafka based on a particular topic (JSON format)
> ->Transform JSON format into some Titan-compliant format -> put them into
> Titan/ElasticSearch on AWS
>
> I have done researching and I believe I can set use the standard processor
> GetKafka and PutElasticSearch for the two "extremes" of the process flow.
> Can you confirm this? Would I need to write my own processor? (I am working
> with Java) I feel that I would need to write a Java processor for the
> actual
> transformation from JSON format into a graph one. Is that correct? Any
> suitable resource/project that can be useful to get me going with this?
>
> Thanks,
>
> I.
>
>
>
> --
> View this message in context:
> http://apache-nifi-developer-list.39713.n7.nabble.com/Import-Kafka-messages-into-Titan-tp8647.html
> Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
>


On Thu, Mar 31, 2016 at 8:31 AM, Simon Ball <sb...@hortonworks.com> wrote:

> You don’t necessarily need a custom processor for this. To convert the
> JSON to key values for a graph for example, you can use EvaluateJsonPath on
> your incoming messages from Kafka, this will pull out the pieces you need,
> then use AttributesToJson to select these attributes back into JSON to push
> to the PutElastic processor.
>
> Simon
>
> > On 31 Mar 2016, at 12:20, idioma <corda.ila...@gmail.com> wrote:
> >
> > Hi,
> > I am very new to NiFi and I have the following flow:
> >
> > Consume Messages from Kafka based on a particular topic (JSON format)
> > ->Transform JSON format into some Titan-compliant format -> put them into
> > Titan/ElasticSearch on AWS
> >
> > I have done researching and I believe I can set use the standard
> processor
> > GetKafka and PutElasticSearch for the two "extremes" of the process flow.
> > Can you confirm this? Would I need to write my own processor? (I am
> working
> > with Java) I feel that I would need to write a Java processor for the
> actual
> > transformation from JSON format into a graph one. Is that correct? Any
> > suitable resource/project that can be useful to get me going with this?
> >
> > Thanks,
> >
> > I.
> >
> >
> >
> > --
> > View this message in context:
> http://apache-nifi-developer-list.39713.n7.nabble.com/Import-Kafka-messages-into-Titan-tp8647.html
> > Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
> >
>
>

Reply via email to