Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Problems with jsonpath???

$
0
0
Hi all,

As an example, I was using a simple JSON document:

"kind": "full",
"type": "customer"

I wanted to use a jsonpath predictate in a choice route as shown below:

from("websocket://0.0.0.0:8080/replication")
.choice()
.when()
.jsonpath("$(@.kind == 'full')
.log("Full update")
.otherwise()
.log("Not full update")

The problem is that I could not get that to work with jsonpath... I did
however get this workaround functional:

from("websocket://0.0.0.0:7080/replication")
.choice()
.when()

.javaScript("JSON.parse(request.body).kind.toLowerCase() == 'full'")
.log(LoggingLevel.INFO, "Full Update")
.otherwise()
.log(LoggingLevel.INFO, "Patch/Put");

Any ideas as to why the jsonpath method is not working?

Thanks in advance!

Deven Phillips

Viewing all articles
Browse latest Browse all 5648

Latest Images

Trending Articles



Latest Images