@redpanda-data/wasm-api

23.1.21 • Public • Published

redpanda wasm-api

Redpanda coprocessing client library for nodejs

How to use?

  1. Simply include the library and create your own instance of the SimpleTransform class.
const wasmJs = const {
  SimpleTransform,
} = require("@redpanda-data/wasm-api");
const transform = new SimpleTransform();
  1. Specify what topics you want your script to consume from:
transform.subscribe(["my-topic", PolicyInjection.Stored]);
  1. And write your custom transform logic that may filter or transform records in any way you'd like.
transform.processRecord((recordBatch) => {
   return Promise.resolve(new Map(....));
});

Whats the expected output?

Use the map returned from the processRecord method to determine what output topics you'd like to produce onto. For example if the recordBatch arrived from 'my-topic' and your Map contains a single key 'Foo', the transformed recordBatch will be produced onto a materialized topic named 'my-topic.$Foo$'. Materialized topics share all topic attributes with its source topic.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 23.1.21
    1
    • latest

Version History

Package Sidebar

Install

npm i @redpanda-data/wasm-api

Weekly Downloads

1

Version

23.1.21

License

ISC

Unpacked Size

5.41 kB

Total Files

3

Last publish

Collaborators

  • frankmanno
  • andres-aristizabal
  • redpanda-bot
  • weeco-redpanda
  • malinskibeniamin
  • dan.redpanda
  • mateo.redpanda
  • sago2k8