@kree4js/dsc
v1.0.13
Published
Distributed Service Callback for Kree4JS
Readme
@kree4js/dsc
Distributed Service Callback for Kree4JS.
Overview
This package provides callback function support for Kree4JS service calls, enabling Node.js-style callback functions to be passed across nodes in a distributed system.
Installation
npm install @kree4js/dscUsage
Basic Usage with enable()
import { enable } from '@kree4js/dsc'
import { KreeX } from '@kree4js/kree4js'
// Create a KreeX instance
const kreex = new KreeX('node-A', 'Node A with DSC support')
// Enable DSC support on the existing instance
const node = enable(kreex)
// Start the node
await node.start()
// Use service with callback
const service = node.service('data-processor')
service.processBatch(records, (err, result) => {
if (err) console.error(err)
else console.log(result)
})API Reference
enable(kreex)
Enables DSC support on an existing KreeX instance by injecting callback interceptors.
kreex(KreeX): An existing KreeX instance.- Returns: The same
KreeXinstance with DSC support.
License
Apache-2.0
