问题
{
"alamrs": [
{
"correlate": [
" ",
" ",
" "
],
"event": " ",
"group": " ",
"history": [
{
"event": " ",
"href": " ",
"id": " ",
"resource": " abc ",
"status": " ",
"text": " ",
"type": " ",
"updateTime": " ",
"user": " ",
"value": "--"
}
],
"href": " ",
"id": "",
"rawData": null,
"receiveTime": " ",
"service": [
" "
],
"resource": "abc",
"status": " ",
"tags": [
""
],
"text": " : ",
"timeout": ,
},
{
"correlate": [
" ",
" ",
" "
],
"event": " ",
"group": " ",
"history": [
{
"event": " ",
"href": " ",
"id": " ",
"resource": " abc ",
"status": " ",
"text": " ",
"type": " ",
"updateTime": " ",
"user": " ",
"value": "--"
}
],
"href": " ",
"id": "",
"rawData": null,
"receiveTime": " ",
"service": [
" "
],
"resource": "abc",
"status": " ",
"tags": [
""
],
"text": " : ",
"timeout": ,
},
{
"correlate": [
" ",
" ",
" "
],
"event": " ",
"group": " ",
"history": [
{
"event": " ",
"href": " ",
"id": " ",
"resource": " abc ",
"status": " ",
"text": " ",
"type": " ",
"updateTime": " ",
"user": " ",
"value": "--"
}
],
"href": " ",
"id": "",
"rawData": null,
"receiveTime": " ",
"service": [
" "
],
"resource": "abc",
"status": " ",
"tags": [
""
],
"text": " : ",
"timeout": ,
}
[here i have used http invoked processor which get alarm from web app ....the response of this processor is in json format ...actually i want this alarm get filter on the bases of resource =abc ..i meant to say the alarm that have the resource = abc which are store in text file ][routedonatrribute configration--property_name=condtion value=${alamrs.resource:equals('abc')}]1[evalutejsonpath---(property=destination- value=flowfile-attribute) (propety_name=condition value=$.alamrs.resource)]1[complete data flow]1[1]: https://i.stack.imgur.com/f0pCF.png
回答1:
I'd suggest using PartitionRecord with a JsonPathReader
to send all records in the flowfile with /*[./alarms/resource=abc] to one relationship and the others to a different relationship.
来源:https://stackoverflow.com/questions/61919533/how-to-apply-condition-on-json-response-in-nifi