-
Feature Request
-
Resolution: Done
-
Major
-
None
Similar to the recently added message filter SMT, it should also be possible to determine the topic a record gets sent to using scripting languages such as JavaScript (graal.js) or Groovy. Going beyond the capabilities of the existing logical topic router (which solely works on the original topic name of change events), such script-based router will allow for true content based change event routing.
E.g. the change events from a table of purchase orders can be routed to two different topics, depending on whether they are B2B or B2C orders:
... transforms=router transforms.router.type=io.debezium.transforms.Router transforms.router.language=jsr223.graals transforms.router.topics=dbserver1.inventory.purchase_order transforms.router.expression=value.after.order_category == 'B2B' ? 'dbserver1.inventory.b2b_orders' : 'dbserver1.inventory.b2c_orders' ...
It'd be useful to be able to refer back to capture group(s) from the topics regex from within the script expression.