[ 
https://issues.apache.org/jira/browse/NIFI-5519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611551#comment-16611551
 ] 

Colin Dean commented on NIFI-5519:
----------------------------------

I'm having a lot of problems getting the above to work with a remote database 
server. it seems to work just fine with SQLite but when accessing MSSQL 2012 
through JTDS, it has issues:


{code}
2018-09-11 22:31:27,499 ERROR [Timer-Driven Process Thread-48] 
o.a.n.p.groovyx.ExecuteGroovyScript 
ExecuteGroovyScript[id=2d9c363f-af36-15a2-a399-46b2fd0f66d4] Scripting error: 
org.apache.nifi.processor.exception.FlowFileHandlingException
: 
StandardFlowFileRecord[uuid=d8bc0870-68b3-4ec1-a8e9-cab176c45211,claim=,offset=0,name=demowarehouse.json,size=0]
 is already marked for transfer
org.apache.nifi.processor.exception.FlowFileHandlingException: 
StandardFlowFileRecord[uuid=d8bc0870-68b3-4ec1-a8e9-cab176c45211,claim=,offset=0,name=demowarehouse.json,size=0]
 is already marked for transfer
        at 
org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3136)
        at 
org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3118)
        at 
org.apache.nifi.controller.repository.StandardProcessSession.putAttribute(StandardProcessSession.java:1759)
        at 
org.apache.nifi.processors.groovyx.flow.ProcessSessionWrap.putAttribute(ProcessSessionWrap.java:471)
        at 
org.apache.nifi.processors.groovyx.flow.ProcessSessionWrap.putAttribute(ProcessSessionWrap.java:52)
        at org.apache.nifi.processor.ProcessSession$putAttribute$0.call(Unknown 
Source)
        at Script78c15242.run(Script78c15242.groovy:134)
        at 
org.apache.nifi.processors.groovyx.ExecuteGroovyScript.onTrigger(ExecuteGroovyScript.java:449)
        at 
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
        at 
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1165)
        at 
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203)
        at 
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
2018-09-11 22:31:27,502 ERROR [Timer-Driven Process Thread-48] 
o.a.n.p.groovyx.ExecuteGroovyScript 
ExecuteGroovyScript[id=2d9c363f-af36-15a2-a399-46b2fd0f66d4] 
org.apache.nifi.processor.exception.FlowFileHandlingException: StandardFlowFil
eRecord[uuid=d8bc0870-68b3-4ec1-a8e9-cab176c45211,claim=,offset=0,name=demowarehouse.json,size=0]
 is not known in this session (StandardProcessSession[id=26460506]): 
org.apache.nifi.processor.exception.FlowFileHandlingException: StandardF
lowFileRecord[uuid=d8bc0870-68b3-4ec1-a8e9-cab176c45211,claim=,offset=0,name=demowarehouse.json,size=0]
 is not known in this session (StandardProcessSession[id=26460506])
org.apache.nifi.processor.exception.FlowFileHandlingException: 
StandardFlowFileRecord[uuid=d8bc0870-68b3-4ec1-a8e9-cab176c45211,claim=,offset=0,name=demowarehouse.json,size=0]
 is not known in this session (StandardProcessSession[id=264605
06])
        at 
org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3132)
        at 
org.apache.nifi.controller.repository.StandardProcessSession.validateRecordState(StandardProcessSession.java:3118)
        at 
org.apache.nifi.controller.repository.StandardProcessSession.putAttribute(StandardProcessSession.java:1759)
        at 
org.apache.nifi.processors.groovyx.flow.ProcessSessionWrap.putAttribute(ProcessSessionWrap.java:471)
        at 
org.apache.nifi.processors.groovyx.flow.ProcessSessionWrap.putAttribute(ProcessSessionWrap.java:52)
        at org.apache.nifi.processor.ProcessSession$putAttribute$0.call(Unknown 
Source)
        at Script78c15242.run(Script78c15242.groovy:151)
        at 
org.apache.nifi.processors.groovyx.ExecuteGroovyScript.onTrigger(ExecuteGroovyScript.java:449)
        at 
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
        at 
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1165)
        at 
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203)
        at 
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
{code}

I think with the amount of time I've spent just trying to do this in an 
ExecuteGroovyScript processor, I could have submitted a PR upstream.

> Allow ListDatabaseTables to accept incoming connections
> -------------------------------------------------------
>
>                 Key: NIFI-5519
>                 URL: https://issues.apache.org/jira/browse/NIFI-5519
>             Project: Apache NiFi
>          Issue Type: Wish
>            Reporter: Matt Burgess
>            Priority: Major
>
> As of [NIFI-5229|https://issues.apache.org/jira/browse/NIFI-5229], 
> DBCPConnectionPoolLookup allows the dynamic selection of a DBCPConnectionPool 
> by name. This allows processors who are to perform the same work on multiple 
> databases to be able to do so by providing individual flow files upstream 
> with the database.name attribute set.
> However ListDatabaseTables does not accept incoming connections, so you 
> currently need 1 DBCPConnectionPool per database, plus 1 ListDatabaseTables 
> per database, each using a corresponding DBCPConnectionPool. It would be nice 
> if ListDatabaseTables could accept incoming connection(s), if only to provide 
> attributes for selecting the DBCPConnectionPool.
> I propose the behavior be like other processors that can generate data with 
> or without an incoming connection (such as GenerateTableFetch, see 
> [NIFI-2881|https://issues.apache.org/jira/browse/NIFI-2881] for details). In 
> general that means if there is an incoming non-loop connection, it becomes 
> more "event-driven" in the sense that it will not execute if there is no 
> FlowFile on which to work. If there is no incoming connection, then it would 
> run as it always has, on its Run Schedule and with State Management, so as 
> not to re-list the same tables every time it executes. 
> However with an incoming connection and an available FlowFile, the behavior 
> could be that all tables for that database are listed, meaning that processor 
> state would not be updated nor queried, making it fully "event-driven". If 
> the tables for a database are not to be re-listed, the onus would be on the 
> upstream flow to not send a flow file for that database. This is not a 
> requirement, just a suggestion; it could be more flexible by honoring 
> processor state if the Refresh Interval is non-zero, but I think that adds 
> too much complexity for the user, for little payoff.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to