Topic Routing
Routing is based on a logical predicate that matches JSON paths with regular expressions, similar to enrichment, but more expressive.
Multiple routes can be configured and there are no rules regarding overlap. JSON path matching converts a dot-notation expression to bracket notation and adds a root starting anchor. For example, the following expression:
request.body.nfConsumerIdentification.nFPLMNID.mcc
Is converted to the following JSON path:
$[request][body][nfConsumerIdentification][nFPLMNID][mcc]
The predicate can use the logical operators and
, or
,
and xor
to construct a set of matching JSON paths.
The following routes a charging data record (CDR) to the
cdr-route-1
topic If it has a value of 505, 456, or 789:
- topic: cdr-route-1
predicate:
path: request.body.nfConsumerIdentification.nFPLMNID.mcc
value: "505|456|789"
The following example routes CDRs to the cdr-route-2
topic if the
mcc
field has a value of 123 and the operation is a charging
request:
- topic: cdr-route-2
predicate:
and:
- path: request.body.nfConsumerIdentification.nFPLMNID.mcc
value: "123"
- path: response.operationName
value: "Nchf_ConvergedCharging.*"
Each logical operator takes two arguments and the predicate can be of any depth. For example, to represent A and B and C:
and:
- A
- and:
- B
- C
To represent A and B or C:
# A and (B or C) becomes:
and:
- A
- or:
- B
- C
To represent A or B and C or D :
# (A or B) and (C or D) becomes:
and:
- or:
- A
- B
- or:
- C
- D
For more information, see the discussion about CDR Kafka Router configuration.