Created 08-16-2018 04:58 PM
Dear community,
I'm creating a proof of concept where I consume messages (JSON) from a kafka topic related to crud operations of a resource. Then, I execute those opperations on a Postgres database.
I've uploaded an image describing what I've done. Depending on an "action" field of JSON, I route it to different processor groups that execute those sql statements.
My problem is that I need to maintain order, i.e. if I have an update after an insert I need to ensure that insert will be executed before the update.
I've played with wait and notify but didn't reach a reasonable solution.
Any suggestion? Is nifi the right tool for this kind of problems?
Thanks in advance
Created 08-16-2018 07:30 PM
I solved it using PutDatabaseRecord. First I load the attribute statement.type with EvaluateJsonPath and then use JsonPathReader as the PutDatabaseRecord reader service, using that statement.type attribute to switch between operations.
If someone have the same problem and needs me to explain it further don't hesitate to ask.
Created 08-16-2018 07:30 PM
I solved it using PutDatabaseRecord. First I load the attribute statement.type with EvaluateJsonPath and then use JsonPathReader as the PutDatabaseRecord reader service, using that statement.type attribute to switch between operations.
If someone have the same problem and needs me to explain it further don't hesitate to ask.
Created 08-17-2018 12:00 PM
@Errico Malatesta good job, glad you were able to work it out!