fiware / tutorials.historic-context-nifi Goto Github PK
View Code? Open in Web Editor NEW:blue_book: FIWARE 302: Persisting Context Data using Apache NIFI
Home Page: https://fiware-draco.rtfd.io/
License: MIT License
:blue_book: FIWARE 302: Persisting Context Data using Apache NIFI
Home Page: https://fiware-draco.rtfd.io/
License: MIT License
Hey there,
I was just trying out the postgres tutorial and after creating a subscription I wanted to check the database. There was no schema "openiot", so I checked for the subscription. According to orion, the subscriptions were sent successfully. So I checked the logs of draco and found the following:
errors in the batch. at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:148) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2184) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:481) at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:840) at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1567) at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:242) at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:242) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:254) at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.access$100(StandardControllerServiceInvocationHandler.java:38) at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler$ProxiedReturnObjectInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:240) at com.sun.proxy.$Proxy140.executeBatch(Unknown Source) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.lambda$new$7(NGSIToPostgreSQL.java:328) at org.apache.nifi.processor.util.pattern.ExceptionHandler.execute(ExceptionHandler.java:127) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.lambda$new$9(NGSIToPostgreSQL.java:326) at org.apache.nifi.processor.util.pattern.PutGroup.putFlowFiles(PutGroup.java:94) at org.apache.nifi.processor.util.pattern.Put.onTrigger(Put.java:103) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.lambda$onTrigger$17(NGSIToPostgreSQL.java:540) at org.apache.nifi.processor.util.pattern.PartialFunctions.onTrigger(PartialFunctions.java:120) at org.apache.nifi.processor.util.pattern.RollbackOnFailure.onTrigger(RollbackOnFailure.java:184) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.onTrigger(NGSIToPostgreSQL.java:540) at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1173) at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:214) at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117) at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) ... 33 common frames omitted Caused by: org.postgresql.util.PSQLException: ERROR: column "recvtimets" of relation "door_003_door" already exists at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307) at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266) at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194) at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:254) at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.access$100(StandardControllerServiceInvocationHandler.java:38) at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler$ProxiedReturnObjectInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:240) at com.sun.proxy.$Proxy141.execute(Unknown Source) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.lambda$new$3(NGSIToPostgreSQL.java:276) at org.apache.nifi.processor.util.pattern.ExceptionHandler.execute(ExceptionHandler.java:127) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.lambda$new$4(NGSIToPostgreSQL.java:265) at org.apache.nifi.processors.ngsi.NGSIToPostgreSQL.lambda$new$6(NGSIToPostgreSQL.java:314) at org.apache.nifi.processor.util.pattern.PutGroup.putFlowFiles(PutGroup.java:91) ... 16 common frames omitted
Hope you know what's going on here..
log from fiware-orion
time=Monday 28 Jun 15:07:28 2021.213Z | lvl=TMP | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=orionldMhdConnectionInit.cpp[494]:orionldMhdConnectionInit | msg=------------------------- Servicing NGSI-LD request 3791: POST /ngsi-ld/v1/entityOperations/upsert/ --------------------------
time=Monday 28 Jun 15:07:38 2021.067Z | lvl=INFO | corr=N/A | trans=1624892255-360-00000000375 | from=pending | srv=pending | subsrv=pending | comp=Orion | op=httpRequestSend.cpp[620]:httpRequestSendWithCurl | msg=Notification Successfully Sent to http://draco:5050/v2/notify
log from fiware-draco
2021-06-28 15:07:34,516 ERROR [Timer-Driven Process Thread-10] o.a.nifi.processors.ngsi.NGSIToMongo NGSIToMongo[id=45007d62-fe1d-3e62-d1a0-f5649b10e89c] Failed to insert StandardFlowFileRecord[uuid=5c9744df-4189-4eac-ba67-2717add484dc,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1624892701155-1, container=default, section=1], offset=55845, length=1138],offset=0,name=5c9744df-4189-4eac-ba67-2717add484dc,size=1138] into MongoDB due to org.json.JSONException: JSONObject["metadata"] not found.: org.json.JSONException: JSONObject["metadata"] not found. org.json.JSONException: JSONObject["metadata"] not found. at org.json.JSONObject.get(JSONObject.java:572) at org.apache.nifi.processors.ngsi.ngsi.utils.NGSIUtils.getEventFromFlowFile(NGSIUtils.java:58) at org.apache.nifi.processors.ngsi.AbstractMongoProcessor.persistFlowFile(AbstractMongoProcessor.java:315) at org.apache.nifi.processors.ngsi.NGSIToMongo.onTrigger(NGSIToMongo.java:78) at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1173) at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:214) at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117) at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
curl -X GET 'http://localhost:1026/ngsi-ld/v1/subscriptions/' -H 'NGSILD-Tenant: openiot'
[ { "id": "urn:ngsi-ld:Subscription:60d9e487092e510f2d732417", "type": "Subscription", "description": "Notify me of all changes", "entities": [ { "type": "Device" }, { "type": "Tractor" } ], "notification": { "format": "normalized", "endpoint": { "uri": "http://draco:5050/v2/notify", "accept": "application/json" }, "timesSent": 2353, "lastNotification": "2021-06-28T15:28:18.195Z" }, "@context": "http://context-provider:3000/data-models/ngsi-context.jsonld" } ]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.