Re: MergeContent resulting in corrupted JSON

2020-06-11 Thread Andy LoPresto
Sorry, TWR = try-with-resources. Definitely a lot of old code that “still works” but is brittle. We should do better about highlighting modern implementations and paying down tech debt, but the project just moves so quickly. Not a perfect rule, but if I see code from one of the core

Re: MergeContent resulting in corrupted JSON

2020-06-11 Thread Jason Iannone
We currently have it encapsulated in code that allows proper isolation and testing, as this is the same methodology applied for standard development. What I wasn't sure is whether Nifi is opinionated and actually preferred and/or performed better with callbacks. There's a lot of older Nifi

Re: NiFi Expression Language in UpdateAttribute

2020-06-11 Thread Andy LoPresto
Russell, I think it would be fine to include an example like this in the Expression Language Guide. You can submit a PR to add that if you like. Andy LoPresto alopre...@apache.org alopresto.apa...@gmail.com He/Him PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > On Jun

Re: Expression language null value

2020-06-11 Thread Andy LoPresto
Yes, can open a Jira for a feature request here [1] and submit a pull request implementing this change here [2]. Please read the Contributor Guide [3] and Developer Guide [4] for more information about this process. [1] https://issues.apache.org/jira/secure/CreateIssue!default.jspa

Re: MergeContent resulting in corrupted JSON

2020-06-11 Thread Andy LoPresto
To give another perspective on the “callback vs. non”, I’d say “heavy” or “messy” operations (like encryption, for example) should be contained in encapsulated code (other classes which provide a service) and then invoked from the callback or TWR. This allows for much more testable business

Re: Route Attribute - Database down

2020-06-11 Thread Luis
HI, I have done that with PostgreSQL and MSSQL, and it comes in the answer read by ExecuteSQL. Maybe I am not understanding your question. If you like please send more details. LC El jue, 11-06-2020 a las 12:11 -0500, KhajaAsmath Mohammed escribió: > Hi, > How can I capture the execution error

Re: Route Attribute - Database down

2020-06-11 Thread Matt Burgess
Although the error attribute can help as a workaround, counting on a text value is probably not the best option (although it's pretty much all we have for now). I wrote up NIFI-7524 [1] to add a "retry" relationship to ExecuteSQL like we have for PutSQL and PutDatabaseRecord. It would route things

Re: Route Attribute - Database down

2020-06-11 Thread KhajaAsmath Mohammed
Yes , you are right Luis. It comes in executesql processor. Sent from my iPhone > On Jun 11, 2020, at 11:41 PM, Luis wrote: > >  > > HI, > > I have done that with PostgreSQL and MSSQL, and it comes in the answer read > by ExecuteSQL. > > Maybe I am not understanding your question. If you

Route Attribute - Database down

2020-06-11 Thread KhajaAsmath Mohammed
Hi, How can I capture the execution error on executesql and route it to different queue when there is failure on the database. executesql.error.message = 'com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Cannot connect to jdbc:sap://hana-xx:30041 [Cannot connect to host

Re: MergeContent resulting in corrupted JSON

2020-06-11 Thread Mark Payne
Jason, Modify vs. clone vs. create new: You would clone a FlowFile if you want an exact copy of the FlowFile (with the exception that the clone will have a unique UUID, Entry Date, etc.). Very rare that a Processor will actually do this. Modify vs. create a “Child” FlowFiles (i.e.,

Re: MergeContent resulting in corrupted JSON

2020-06-11 Thread Jason Iannone
I confirmed what you mentioned as well. I also looked over many custom processor examples and looking for clarification on a few things which I didn't see explicitly called out in the developers guide. - Are their guidelines on when one should modify the original flowfile vs when you

Re: Expression language null value

2020-06-11 Thread Fabrizio Spataro
... ping ... -- Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/

Re: NiFi Expression Language in UpdateAttribute

2020-06-11 Thread Russell Bateman
That solves confusion I had after and despite reading the NiFi Expression Language documentation. Having written documentation before, I get why it's never ending and danger-fraught to write "bigger" examples in such documentation, and we resist doing it, but that's what I needed to clear up

Re: NiFi Expression Language in UpdateAttribute

2020-06-11 Thread Bryan Bende
Hello, The EL docs have some good examples: https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#ifelse -Bryan On Thu, Jun 11, 2020 at 10:14 AM Russell Bateman wrote: > I wnat to create an attribute, format-type, which I hoped would be set > based on the in-coming

Re: NiFi Expression Language in UpdateAttribute

2020-06-11 Thread Shawn Weeks
Your syntax is incorrect. Try this instead. ${filename:endsWith('xml'):ifElse('XML','JSON')} From: Russell Bateman Reply-To: "users@nifi.apache.org" Date: Thursday, June 11, 2020 at 9:15 AM To: NiFi Users Subject: NiFi Expression Language in UpdateAttribute I wnat to create an attribute,

NiFi Expression Language in UpdateAttribute

2020-06-11 Thread Russell Bateman
I wnat to create an attribute, format-type, which I hoped would be set based on the in-coming flowfile name:     ${ ${filename:endsWith( 'xml' )} : ifElse( 'XML', 'JSON' ) } If the in-coming flowfile name is /sample.xml/, the result is nevertheless and always format-type = JSON I want it