Member since
08-11-2017
136
Posts
1
Kudos Received
0
Solutions
10-18-2017
01:02 PM
IIRC, Groovy 3 is supposed to support the Java lambda syntax, but NiFi uses Groovy 2 which does not support it. However Groovy has always had Closures, which are very similar and used for the same purpose, so despite a small difference in syntax, you should be able to use Groovy closures the same as you would use Java lambdas. If you are referring to the Java Streams API (things like foreach() that take a lambda), Groovy has iterative and aggregate functions for that too, such as each() and eachWithIndex(), spread-dot and collect(), etc.
... View more
10-19-2017
01:47 PM
yes it was helpful thank you
... View more
10-06-2017
05:25 AM
I have set keep source file to false i have relative logic in my processors but when i get flowfile from folder i want to update it's data and then route it back to same folder but when i try to make this i mean putting i root folder it saves file i this forma '.filename.xml" how can i prevent doing this?
... View more
09-26-2017
06:58 PM
Hi @sally sally, if you are extracting only one value to attribute then its easy to use ExtractText processor:- by adding new property to it by adding regex like below. <count>(.*)<\/count> ExtractText Processor configs:- This regex only captures the value in <count></count> message and adds an attribute count to the flowfile.
... View more
09-26-2017
02:53 AM
@sally sally Route on content is to match the contents of ff we cannot compare attribute inside this processor. But we can acheive by using RouteOnAttribute Processor:- as we are having ${message.body} as attribute then add a property ${message.body:contains('<person>')} it will look for message.body attribute contains <person> or not. if yes then it routes to person relation and if ff not having <person> it will routes to unmatched relation. RouteOnContent Processor:- As you are having $message.body as attribute we are not able to use RouteOnContent processor, because it will look the content of ff to find match. E.g:-How RouteOnContent works? Input:- <?xml version="1.0" encoding="UTF-8"?>
<note>
<person>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note> If we are having the above input as the ff content then in Route on content processor we need to give property as It will look for is the content of ff having <person> or not In our case it is yes then it will route to person relation.
... View more
09-25-2017
08:21 AM
You could use the EvaluateXPath processor to check for the presence of specific elements in your XML. Use a Destination of flowfile-attribute to create a dynamic attribute for your tag value, then use RouteOnAttribute and check if the value is empty.
... View more
09-24-2017
12:23 PM
@sally sally, i think if you need to merge files based on filename then you have to use those many merge content processors(e.g if 100 filenames you need to have 100 merge contents). Can you please share more details about your merging strategy on what basis you are merging the flow files is it based on size(or) some thing else? and can also share us the configs that you are using now to merge content based on filename?
... View more
09-27-2017
03:45 AM
You won't be able to do what you want with a single XPath, but this XSLT... <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:foo="***" exclude-result-prefixes="foo">
<xsl:template match="/DayInfo">
<xsl:for-each select="foo:TalkMessage/foo:Body/foo:person">
<xsl:result-document method="xml" href="person_{foo:id}.xml">
<DayInfo>
<TalkMessage xmlns="***">
<xsl:copy-of select="/DayInfo/foo:TalkMessage/foo:EnvelopeVersion" />
<xsl:copy-of select="/DayInfo/foo:TalkMessage/foo:Header" />
<xsl:copy-of select="/DayInfo/foo:TalkMessage/foo:TalkDetails" />
<xsl:element name="Body" namespace="***">
<xsl:copy-of select="." />
</xsl:element>
</TalkMessage>
</DayInfo>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
will convert this XML (which is similar to your sample XML response)... <?xml version="1.0" encoding="UTF-8"?>
<DayInfo>
<TalkMessage xmlns="***">
<EnvelopeVersion>**</EnvelopeVersion>
<Header>
<MessageDetails>
<Class>****</Class>
<Qualifier>*****</Qualifier>
<Function>***</Function>
<CorrelationID>*****</CorrelationID>
<ResponseEndPoint/>
</MessageDetails>
<SenderDetails>
<IDAuthentication/>
<EmailAddress/>
</SenderDetails>
</Header>
<TalkDetails>***</TalkDetails>
<Body>
<!-- with message like -->
<person>
<id>34</id>
<name>Moira Theriault</name>
</person>
<person>
<id>35</id>
<name>Cheree Meacham</name>
</person>
<person>
<id>36</id>
<name>Kris Demery</name>
</person>
<contact>...</contact>
<data>...</data>
</Body>
</TalkMessage>
</DayInfo>
and will create these three files, person_34.xml, person_35.xml, person_36.xml: <?xml version="1.0" encoding="UTF-8"?>
<DayInfo>
<TalkMessage xmlns="***">
<EnvelopeVersion>**</EnvelopeVersion>
<Header>
<MessageDetails>
<Class>****</Class>
<Qualifier>*****</Qualifier>
<Function>***</Function>
<CorrelationID>*****</CorrelationID>
<ResponseEndPoint/>
</MessageDetails>
<SenderDetails>
<IDAuthentication/>
<EmailAddress/>
</SenderDetails>
</Header>
<TalkDetails>***</TalkDetails>
<Body>
<person>
<id>34</id>
<name>Moira Theriault</name>
</person>
</Body>
</TalkMessage>
</DayInfo>
<?xml version="1.0" encoding="UTF-8"?>
<DayInfo>
<TalkMessage xmlns="***">
<EnvelopeVersion>**</EnvelopeVersion>
<Header>
<MessageDetails>
<Class>****</Class>
<Qualifier>*****</Qualifier>
<Function>***</Function>
<CorrelationID>*****</CorrelationID>
<ResponseEndPoint/>
</MessageDetails>
<SenderDetails>
<IDAuthentication/>
<EmailAddress/>
</SenderDetails>
</Header>
<TalkDetails>***</TalkDetails>
<Body>
<person>
<id>35</id>
<name>Cheree Meacham</name>
</person>
</Body>
</TalkMessage>
</DayInfo>
<?xml version="1.0" encoding="UTF-8"?>
<DayInfo>
<TalkMessage xmlns="***">
<EnvelopeVersion>**</EnvelopeVersion>
<Header>
<MessageDetails>
<Class>****</Class>
<Qualifier>*****</Qualifier>
<Function>***</Function>
<CorrelationID>*****</CorrelationID>
<ResponseEndPoint/>
</MessageDetails>
<SenderDetails>
<IDAuthentication/>
<EmailAddress/>
</SenderDetails>
</Header>
<TalkDetails>***</TalkDetails>
<Body>
<person>
<id>36</id>
<name>Kris Demery</name>
</person>
</Body>
</TalkMessage>
</DayInfo>
Of course, you'll need to include your actual namespace. If you don't have access to an XSLT 2.0 processor, you can use the <exslt:document> extension element to XSLT 1.0.
... View more
09-19-2017
08:56 PM
@sally sally, can you make use of below search property ^<[^>]+>(.*)\<\/\?.*\>$ Replacetext Configs:- Input:- <?xml version="1.0" encoding="utf-8"?>abc</?xml version="1.0" encoding="utf-8"?> Output:- <DailyData>abc</DailyData>
... View more
09-19-2017
02:09 PM
@sally sally By setting your minimums (Min Num Entries and Min Group Size to some large value), FlowFiles that are added to a bin will not qualify for merging right away. You should then set "Max Bin Age" to a unit of time you are willing to allow a bin to hang around before it is merged regardless of the number of entries in that bin or that bins size. As far as the number of bins go, a new bin will be created for each unique filename found in the incoming queue. Should the MergeContent processor encounter more unique filenames then there are bins, the MergeContent processor will force merging of the oldest bin to free a bin for the new filename. So it is important to have enough bins to accommodate the number of unique filenames you expect to pass through this processor during the configured "max bin age" duration; otherwise, you could still end up with 1 FlowFile per merge. Thanks, Matt
... View more