Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to route this based on if the field in Alert is 'Critical' or not.

I've tried RouteOnAttribute processor and also an EvaluateJson processor. Neither are working.

For RouteOnAttribute I've tried

Alerted: ${Payload:jsonPath('$.Alert'):equals('Critical')}

Then I have a relationship based on Alerted but nothing ever goes into my RouteOnAttribute processor, the queue just sits there till it fills to 10,000.

I need the full JSON to be routed, I can't lose information in the routing.

The issue is with jsonPath function works on flowfile attributes but you are not having Payload attribute associated with the flowfile.

How to add attribute to the flowfile?

After generateflowfile processor use EvaluateJsonPath processor with destination as flowfile-attribute ,

Add new property

payload.alert as $.Payload.Alert

Then use routeonattribute processor add new property as

Alerted

${payload.alert:equals('Critical')}

Flow:

1.GenerateFlowFile
2.EvaluateJsonPath //extract the value and keep as attribute to the flowfile
3.RouteOnAttribute //check the attribute value
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.