Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Expand
titleContents

Table of Contents
indent15px
stylenone

JsonCBR (Json Content Based Routing) is used to route the incoming messages onto different destinations based on the content of the messages. The component creates a port for each of the JsonPath expressions specified and the messages satisfying the particular JsonPath expression is sent onto the respective port. In addition to these ports, an output port OUT_FALSE is created and messages whose content does not satisfy any of the JsonPath expressions will be sent out of this port. If more than one JsonPath expression is true, the message is sent on all the ports for which the JsonPath expression evaluates to true.

Info

A Json expression is a combination of a JsonPath, operator, and a value (if needed).

...

Comparison of the JSONPath syntax elements with its XPath counterparts
XPathJSONPathDescription
/$the root object/element
..n/aparent operator
//..recursive descent. JSONPath borrows this syntax from E4X.
**wildcard. All objects/elements regardless their names.
@n/aattribute access. JSON structures don't have attributes.
[][]subscript operator. XPath uses it to iterate over element collections and for predicates. In Javascript and JSON, it is the native array operator.
|[,]Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set.
n/a[start:end:step]array slice operator borrowed from ES4.
[]?()applies a filter (script) expression.
n/a()script expression, using the underlying script engine.
()n/agrouping in XpathXPath
Tip

For more information on the XPath for Json, please refer the article.

...

This field can be any of these types: Long, Integer, Double, String, Boolean, BigInteger, BigDecimal, and JsonPath. If a "$" precedes any value, then it is treated as a JsonPath. In this case, values of the two JsonPaths are compared for evaluating the expression.

Functional Demonstration

Scenario

JsonCBR is configured to filter the messages on the basis of book price in the input message. It is sent to one of the output ports depending on the JsonPath specified in the JsonCBR CPS.

...

Adaptavist ThemeBuilder EngineAtlassian Confluence